- Home
·
- String Manipulation
·
- Validate a string for non-allowed telephone characters. Since you might want to allow certain chara
Validate a string for non-allowed telephone characters. Since you might want to allow certain chara
Validate a string for non-allowed telephone characters. Since you might want to allow certain characters this allows you to validate none
Rate Validate a string for non-allowed telephone characters. Since you might want to allow certain chara
(1(1 Vote))
Dim lngIndex As Long
Dim sCurrentChar As String
Dim lngCompareIndx As Long
Dim sCompareStr As String
Dim sCurrCmpStrChar As String
On Error GoTo Err_Handler
'Non allowed characters into string
'Note that X is allowed for eXtension
'Add to the sCompareStr if you want to additional characters
sCompareStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
For lngCompareIndx = 1 To Len(Trim(sCompareStr))
sCurrCmpStrChar = Mid$(Trim(sCompareStr), lngCompareIndx, 1)
' Check the string
For lngIndex = 1 To Len(Trim(sTeleString))
'Load Current char of string to validate
sCurrentChar = Mid$(Trim(sTeleString), lngIndex, 1)
'Check if character is non allowed
If UCase$(sCurrentChar) = UCase$(sCurrCmpStrChar) Then
X = False
End If
Next lngIndex
Next lngCompareIndx
'If Successful...
XTele = True
Exit Function
'On Error...
Err_Handler:
MsgBox Err.Description, vbCritical
XTele = False
End Function
Validate a string for non-allowed telephone characters. Since you might want to allow certain chara Comments
No comments yet — be the first to post one!
Post a Comment