Saturday, April 11, 2009

Check if the given string is AlphaNumeric

This code sample returns true if the passed stirng contains only alpha numeric characters.


Public Shared Function IsAlphaNumeric(ByVal strToCheck As String) As Boolean
Dim pattern As Regex = New Regex("[^a-zA-Z0-9]")

Return Not pattern.IsMatch(strToCheck)
End Function

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home