How to Remove all Non Alpha Numeric characters from a given string
Posted on January 4, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 'String Manipulation - How to Remove all Non Alpha Numeric characters from a given string Option Explicit Public Function RemoveAllNonAlphaNumeric(ByVal strText As String) As String Dim strResult As String Dim I As Integer For I = 1 To Len(strText) Select Case Asc(Mid$(strText, I, 1)) Case 48 To 57, 65 To 90, 97 To 122 'a digit or Uppercase Alphabet or Lowercase Alphabet strResult = strResult & Mid$(strText, I, 1) Case Else 'Reject any other key. 'do nothing End Select Next I ExitHere: RemoveAllNonAlphaNumeric = strResult End Function |