title: C# Remove unwanted characters from a string
body: <p>I have looked into other posts, and all of them have known unwanted characters.
  In my case, I have a bunch of characters that I want, and I only want to keep those.</p>
  
  <p>My code is way too messy:</p>
  
  <pre><code>private string RemoveUnwantedChar(string input)
  {
      string correctString = "";
  
      for (int i = 0; i &lt; input.Length; i++)
      {
          if (char.IsDigit(input[i]) || input[i] == '.' || input[i] == '-' || input[i] == 'n'
                  || input[i] == 'u' || input[i] == 'm' || input[i] == 'k' || input[i] == 'M'
                  || input[i] == 'G' || input[i] == 'H' || input[i] == 'z' || input[i] == 'V'
                  || input[i] == 's' || input[i] == '%')
              correctString += input[i];
      }
      return correctString;
  }
  </code></pre>
  
  <p>Characters that I want: <code>0123456789</code> and <code>numkMGHzVs%-.</code></p>