DigitsORLettersOnly

Check if the string has special characters or not, only Letters or digits (DigitsORLetters)
Returns TRUE if string has only letters or digits (no special chars)
FALSE if it has at least one special character (that is not letter nor digit), see examples.
currently works for English language only

CodeFunctionName
What is this?

Public

Tested

Original Work
Function DigitsORLettersOnly(TheString)
' Check if the string has only Letters or digits (DigitsORLetters)
Rett = 1
For i = 1 To Len(TheString)
Chr1 = Asc(Mid(TheString, i, 1))
If (Chr1 >= 48 And Chr1 <= 57) Or _
(Chr1 >= 65 And Chr1 <= 90) Or _
(Chr1 >= 97 And Chr1 <= 122) _
Then
' We may continue checking
Else
Rett = 0
Exit For
End If
Next i
DigitsORLettersOnly = Rett
End Function

TheString

? DigitsORLettersOnly("days3")
1
? DigitsORLettersOnly("days=3")
0

Views 3,460

Downloads 1,333

CodeID
DB ID