View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default Efficient way to drtermine if a string contains digits?

Yes, that is the fastest, but of course it doesn't give the position of the
first digit.

Did some timing, running on this string:
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2aaabbbbbbbbbbb 3bbb"

Jim 4 msecs
RBS 24 msecs
Ron 5200 msecs

Of course the VBScript method will be a lot faster if the first 3 lines of
code are taken out of the function.


RBS


"Jim Cone" wrote in message
...
-Or-

Function WhoHowWhat(ByRef str As String) As Boolean
WhoHowWhat = (str Like "*#*")
End Function
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




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!!