|Keep It Simple, Stupid|
Re: Checking for numbers and a periodby krusty (Hermit)
|on Jul 21, 2002 at 03:02 UTC||Need Help??|
So the possibilities are that a price might fall into the following catagories:
...where the first portion of the pattern matches the first three possible formats listed above and the second portion matches a format like .25.
Have I missed any formats?
UpdatePlease include the anchors ^$ as in Corion's update. It will prevent the if statement from running as my code would return true for 300.25.25.
Corion's code misses fractions of cents. Like if something is 99 and 1/2 cent. This may be a desirable trait though. My code misses the European spaces. All the code I've seen so far also misses things like 1,000,000,000.25. This can still be written for, but how far do you really need to go to accomplish your task?