Whats the matter with loops. Any solution given will probably (whether expilcitly or internally) have to loop through each character in the string and see if its a digit or a '.' (although not more than one). What kind of solution were you interested in?P.S.: Please do not tell me about Character.IsDigit - I don't want loops!
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Originally posted by Jesper Young:
But if you absolutely don't want to use a loop, you could do it using a regular expression
Lookup the API documentation of class Pattern in the package java.util.regex to understand how it works.
"I'm not back." - Bill Harding, Twister
"I'm not back." - Bill Harding, Twister
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |