Monthly Archives: November 2010

VBScript String Clean

Filed under Uncategorized

How to remove or replace illegal characters from a string using VBScript

There are a number of ways that string can be manipulated using VBScript to remove or replace certain characters from a string.  The most efficient is to use regular expressions and a search pattern to replace characters, which would be done using the Replace method of the regular expression object in VBScript.  The second most effective method is to use the replace method available in VBScrtip.

An array can be created that contains the set of characters to removed or replaced.  A loop can the iterate through each character in the array to remove or replace any instances in the string.

For more details, and additional methods and scenarios for removing or replacing illegal characters in VBScript, see VBScript String Clean – Remove or Replace Illegal Characters.