include("../include.php"); writeHeader("Remove unwanted characters", "Programming » Visual Basic 6 » Visual Basic 6 Code » Strings » ");?>
Public Function RemoveCharacters(ByRef strText As String) '------------------------------------------ 'Replaces the characters set in strUnwanted as spaces '------------------------------------------ Dim currLoc As Integer Dim StringLength As Integer Dim tmpChar As String Dim strUnwanted As String strUnwanted = "~`!@#$%^&*()_+-=|\?/.>,<" & Chr(34) StringLength = Len(strText) For currLoc = 1 To StringLength tmpChar = Mid(strText, currLoc, 1) If InStr(strUnwanted, tmpChar) Then tmpChar = " " 'replace with a space End If RemoveCharacters = RemoveCharacters & tmpChar Next End Function