Hello,
Can someone please tell me what I need to look for in the Language reference, regarding checking a TextField to see if it does NOT contain the numbers 1, 2,3,4,5,6,7,8 or 9
Basically I need to check a TextField, and if it DOES contain any of the numbers 1-9, then do nothing, otherwise, do something.
The Language reference is so large, and I don’t even know what to look for
You’d use a regular expression. The pattern is simply [1-9] so a match would mean it does contain one of those numbers.
dim rx as new RegEx
rx.SearchPattern = "[1-9]"
dim match as RegExMatch = rx.Search( theTextField.Text )
if match is nil then // Doesn't have a number
else // Does have a number
end if
Put this in a Module and make set the functions scope to “global”:
Function ContainsDigits(Extends str As String) As Boolean
Dim mb As MemoryBlock = str
Dim ub As Integer = str.Len - 1
For i As Integer = 0 To ub
If mb.Byte(i) >= 48 And mb.Byte(i) <= 57 Then
Return True
End
Next
Return False
End Function
Then use it like this: