Home > How-To Library > String Manipulation

How to Remove unwanted characters from a string

**************************************************************** * © 2007 CodeItBetter http://www.codeitbetter.com * * This notice MUST stay intact for legal use * ****************************************************************
'This code removes unwanted characters from a string. Function PurgeString(OldStr As String) As String Dim NewStr As String Dim l As Long For l = 1 To Len(OldStr) If Asc(Mid(OldStr, l, 1)) > 31 Then NewStr = NewStr & Mid(OldStr, l, 1) End If Next PurgeString = NewStr End Function

If you would like to submit your code here please us. Do not forget to mention your name. We are always thankful to each and everyone of you who submitted their code here.