title: How to remove characters from a string, except those in a list
body: <p>This is my string value:</p>
  
  <pre><code>string str = "32 ab d32";
  </code></pre>
  
  <p>And this list is my allowed characters:</p>
  
  <pre><code>var allowedCharacters = new List&lt;string&gt; { "a", "b", "c", "2", " " };
  </code></pre>
  
  <p>I want it to become:</p>
  
  <pre><code>str == " 2 ab   2";
  </code></pre>
  
  <p>I would like to replace any character that is not in the allowed character list,  with an empty space.</p>