Code Vault

How to clean invisible characters from string using VBScript

</p><p> </p><p>Public Function strClean(strToClean)
    Dim inStringArray()
    ReDim inStringArray(len(strToClean) - 1)
    For iterator = 1 to Len(strToClean)
        currentChar = Mid(strToClean, iterator, 1)
        currentCharASCII = Asc(currentChar)
        If currentCharASCII = 0 OR (currentCharASCII >= 7 AND currentCharASCII <= 13) OR currentCharASCII = 27 OR currentCharASCII = 63 Then
            inStringArray(iterator - 1) = ""
        Else
            inStringArray(iterator - 1)=currentChar
        End If
    Next
    strClean = Join(inStringArray, "")
End Function</pre>
&nbsp;

&nbsp;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s