by BC Bahrenburg (2 Submissions)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 10th May 2001
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
Validate a string for non-allowed telephone characters. Since you might want to allow certain characters this allows you to validate none
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
No comments have been posted about Validate a string for non-allowed telephone characters. Since you might want to allow certain chara. Why not be the first to post a comment about Validate a string for non-allowed telephone characters. Since you might want to allow certain chara.