by CRMcG (1 Submission)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 7th July 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
This is the alpha equivalent to IsNumeric. Returns a true if accepted characters are found while looping through the string. Good for
'IsAlpha - locate illegal charactes in the subject field
Public Function IsAlpha(strText As String) As Boolean
Dim intLen As Integer
Dim intCounter As Integer
Dim blnAlpha As Boolean
Dim strChar As String
intLen = Len(strText)
'Set the condition of our loop
For intCounter = 1 To intLen
strChar = Mid(strText, intCounter, 1)
'Accept A through z"
If strChar >= "A" And strChar <= "z" Then
blnAlpha = True
Else
'Accept "spaces", "periods", and "commas"
If strChar = " " Or strChar = "." Or strChar = "," Then
blnAlpha = True
'Reject everything else.
Else
blnAlpha = False
End If
End If
'We caught an illegal character (not A-z, " ", ".", or ","
If blnAlpha = False Then
IsAlpha = False
Exit Function
End If
Next intCounter
IsAlpha = True
End Function
No comments have been posted about This is the alpha equivalent to IsNumeric. Returns a true if accepted characters are found while lo. Why not be the first to post a comment about This is the alpha equivalent to IsNumeric. Returns a true if accepted characters are found while lo.