Efficient way to drtermine if a string contains digits?
Another way, a reusable function that enables you to modify to the chars
allowed in the text, now limited to numbers:
Sub Test2()
MsgBox HasCharAllowed("3 test")
End Sub
Function HasCharAllowed(ByVal s As String) As Boolean
Const CharsAllowed = "0123456789"
Dim i As Integer
HasCharAllowed = False
For i = 1 To Len(s)
If InStr(CharsAllowed, Mid(s, i, 1)) 0 Then
HasCharAllowed = True
Exit For
End If
Next
End Function
wrote in message
...
What is the most efficient way to determine if any of the characters of a
string are digits?
One example would be a function that returns "TRUE" if one or more
characters of its single argument are digits and "FALSE" otherwise.
Thanks!!
|