title: vbscript - Replace all spaces
body: <p>I have 6400+ records which I am looping through. For each of these: I check that the address is valid by testing it against something similar to what the Post Office uses (find address). I need to double check that the postcode I have pulled back matches.</p>
  
  <p>The only problem is that the postcode may have been inputted in a number of different formats for example:</p>
  
  <pre><code>OP6 6YH
  OP66YH
  OP6  6YH. 
  </code></pre>
  
  <p>If Replace(strPostcode," ","") = Replace(xmlAddress.selectSingleNode("//postcode").text," ","") Then</p>
  
  <p>I want to remove all spaces from the string. If I do the Replace above, it removes the space for the first example but leave one for the third.</p>
  
  <p>I know that I can remove these using a loop statement, but believe this will make the script run really slow as it will have to loop through 6400+ records to remove the spaces.</p>
  
  <p>Is there another way? </p>