title: How to match a string inside another string while ignoring whitespace
body: <p>I have a string to search, and I need to match and return another string at the beginning of the search string. The string being searched may have whitespace in it, which needs to be ignored for the purpose of searching, but still returned accurately. The string to be matched will never have whitespace in it.</p>
  
  <pre><code>stringA = "ThisIsAString";
  </code></pre>
  
  <p>Should give the following results when compared to stringB:</p>
  
  <pre><code>stringB = "This    Is A String";    //"This    Is A String"
  stringB = "ThisIsAlsoAString";    //undefined
  stringB = "ThisIs A String With Extra Words At The End";    //"ThisIs A String"
  stringB = "Hey, ThisIsAString";     //undefined
  </code></pre>
  
  <p>What's an efficient way to do this?</p>