title: How to insert/remove hyphen to/from a plain string in c#?
body: <p>I have a string like this;</p>
  
  <pre><code>   string text =  "6A7FEBFCCC51268FBFF";
  </code></pre>
  
  <p>And I have one method for which <strong>I want to insert the logic for appending the hyphen after 4 characters</strong> to 'text' variable. So, the output should be like this;</p>
  
  <pre><code>6A7F-EBFC-CC51-268F-BFF
  </code></pre>
  
  <p>Appending hyphen to above 'text' variable logic should be inside this method;</p>
  
  <pre><code>public void GetResultsWithHyphen
  {
       // append hyphen after 4 characters logic goes here
  }
  </code></pre>
  
  <p>And I want also <strong>remove the hyphen from a given string</strong> such as <code>6A7F-EBFC-CC51-268F-BFF</code>. So, removing hyphen from a string logic should be inside this method;</p>
  
  <pre><code>public void GetResultsWithOutHyphen
  {
       // Removing hyphen after 4 characters logic goes here
  }
  </code></pre>
  
  <p><strong>How can I do this in C# (for desktop app)?
  What is the best way to do this?</strong>
  Appreciate everyone's answer in advance.</p>