How to check if a string contains only Alpha Numeric Characters
Posted on January 4, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 'String Manipulation - How to check if a string contains only Alpha Numeric Characters Option Explicit Public Function IsAlphaNumeric(sExpression As String) As Boolean 'Returns True if all characters in a string are alphabetical or numeric 'Returns False otherwise or for empty string Dim sTemp As String Dim iLen As Integer Dim iCount As Integer Dim sChar As String sTemp = sExpression iLen = Len(sTemp) If iLen > 0 Then For iCount = 1 To iLen sChar = Mid(sTemp, iCount, 1) If Not sChar Like "[0-9A-Za-z]" Then Exit Function Next IsAlphaNumeric = True End If End Function |
Related posts:
- How to check if a string contains only Numeric Characters
- How to check if a string contains only Alphabetical Characters
- How to Test if a character is Alpha Numeric.
- How to Remove all Non Alpha Numeric characters from a given string
- How to Strip Non Alpha Numeric from a string
- How to Strip special characters from a given String
- How to Remove all numeric characters from a string
- How to Strip Numeric from a string
- How to check whether given string is numeric or not without using IsNumeric function.
- How to remove Duplicate characters from a string