Knowledge Share

Knowledge is NOT Power IMPLEMENTATION of knowledge is Power!!!
 
HomePortalGalleryCalendarFAQRegisterUsergroupsLog in

Share | 
 

 Validating Apha Numeric

View previous topic View next topic Go down 
AuthorMessage
Admin
Admin


Posts : 142
Points : 410
Reputation : 0
Join date : 2007-12-29
Location : Chennai

PostSubject: Validating Apha Numeric   Wed Jun 10, 2015 11:43 am

Dim intCounter As Integer
Dim strCompare As String
Dim strInput As String
checkAlphaNumeric = False
 
For intCounter = 1 To Len(strInputText)
    strCompare = Mid$(strInputText, intCounter, 1)
    strInput = Mid$(strInputText, intCounter + 1, Len _ (strInputText))
    If strCompare Like ("[A-Z]") Or _
        strCompare Like ("[a-z]") Or _
        strCompare Like ("#") Then
        checkAlphaNumeric = True
    Else
        checkAlphaNumeric = False
        Exit Function
    End If
Next intCounter
 
End Function
 

Public Function IsAlphaBetical(TestString As String) As Boolean

Dim sTemp As String
Dim iLen As Integer
Dim iCtr As Integer
Dim sChar As String

'returns true if all characters in a string are alphabetical
'returns false otherwise or for empty string

sTemp = TestString
iLen = Len(sTemp)
If iLen > 0 Then
For iCtr = 1 To iLen
sChar = Mid(sTemp, iCtr, 1)
If Not sChar Like "[A-Za-z]" Then Exit Function
Next

IsAlphaBetical = True
End If

End Function

Public Function IsAlphaNumeric(TestString As String) As Boolean

Dim sTemp As String
Dim iLen As Integer
Dim iCtr As Integer
Dim sChar As String

'returns true if all characters in a string are alphabetical
' or numeric
'returns false otherwise or for empty string

sTemp = TestString
iLen = Len(sTemp)
If iLen > 0 Then
For iCtr = 1 To iLen
sChar = Mid(sTemp, iCtr, 1)
If Not sChar Like "[0-9A-Za-z]" Then Exit Function
Next

IsAlphaNumeric = True
End If

End Function

Public Function IsNumericOnly(TestString As String) As Boolean

Dim sTemp As String
Dim iLen As Integer
Dim iCtr As Integer
Dim sChar As String

'returns true if all characters in string are numeric
'returns false otherwise or for empty string

'this is different than VB's isNumeric
'isNumeric returns true for something like 90.09
'This function will return false

sTemp = TestString
iLen = Len(sTemp)
If iLen > 0 Then
For iCtr = 1 To iLen
sChar = Mid(sTemp, iCtr, 1)
If Not sChar Like "[0-9]" Then Exit Function
Next

IsNumericOnly = True
End If

End Function
Back to top Go down
http://knowledgeshare.forumotion.com
 
Validating Apha Numeric
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» Validating data displayed in a read-only textfield
» Validating 'random' text based on xpath

Permissions in this forum:You cannot reply to topics in this forum
Knowledge Share :: Testing :: Automation :: VSTS :: CODED UI-
Jump to: