Currency and percentage in numeric evaluation
Robert Brenstein
rjb at robelko.com
Sun Apr 10 23:23:58 EDT 2005
>Richard,
>You could add zero to it and see if you get an error.
>Since currency signs are usually the first of last character, you could strip
>the first or last character after using the zero test above, then test for
>zero again.
>Or make a list of all major currencies and see if the first or last character
>of the string is in the list (the currency list will probably be shorter than
>you expect).
>Paul Looney
With currencies things are a bit more messy than that, I am afraid.
Currency symbol may be more than a single character. It can be up
front or behind. There may be a space between the currency symbol and
the number. Then, if decimals are allowed, as it usually is with
currencies, the decimal separator could be period or comma depending
where the entries originate. Accounting-type reporting will usually
have thousands separator as well. I doubt it is possible to have a
generic checking routine that does not include explicit knowledge of
currency symbols unless you do not care whether these are truly
currencies. Then you could go word by word using matchtext to see if
there is a number up front or in back.
Robert
More information about the use-livecode
mailing list