Currency and percentage in numeric evaluation

Eric Chatonet eric.chatonet at sosmartsoftware.com
Sun Apr 10 11:46:47 EDT 2005


Hi Richard,

A post by Thierry Douez (Rép : Seperate numbers from text Date: 6 avril 
2005 10:18:44 GMT+02:00) might get you started:

> Hi,
>
> DR> Is there a way to seperate numbers from text in a string?
> DR> e.g "string69" to return 69 or "string69also" to return 69
>
> try this :
>
>   put "asdfsdfsdf765xcxccxcv123cvccv" into s
>   -- erase all numbers
>   put replaceText( s, "\d+",  empty ) into r1
>
>   -- erase all text
>   put replaceText( s, "[^\d]+",  empty ) into r2

But I am afraid it's a real problem if you want to trigger all kinds of 
expressions :
$12
12 $
$12.65
12,65 $
etc.
If you have no decimal values, an approach by "word" may be helpful...

Best regards,

Le 10 avr. 05, à 17:03, Richard Gaskin a écrit :

> I need to evaluate a large number of short strings to determine 
> whether they are numeric.  Some of these are percentages, and include 
> the "%", and others are currency and can contain "$". the Euro, Yen, 
> or any number of other signs.
>
> With dates we have a convenient test:  try to convert it, and if it 
> fails it will tell you why.
>
> But we have no such convenience with percentages and currency.  So 
> what is the most efficient (heck, I'd settle for reasonable efficient) 
> way to determine if a string is numeric given the wide range of 
> currency formats in common use?

Eric Chatonet.
----------------------------------------------------------------
So Smart Software

Pour les institutionnels, les entreprises et les associations
Des logiciels sur mesure : gestion, multimédia, internet, etc.
Windows, Mac OS et Linux... Avec la "french touch"

For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch
----------------------------------------------------------------
Web site		http://www.sosmartsoftware.com/
Email		eric.chatonet at sosmartsoftware.com/
Phone		33 (0)1 43 31 77 62
Mobile		33 (0)6 20 74 50 86
----------------------------------------------------------------



More information about the use-livecode mailing list