Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
library to rurn money into nominal value?
Peter Szinek
1/24/2007 11:02:00 AM
Hi,
I wonder if there is something like $subj so that I don't reinvent the
wheel. What I need is something like:
money_to_val('$12.56') => 12.56
money_to_val('$ 12.56') => 12.56
money_to_val('$ 12,56') => 12.56
money_to_val('US$ 12,56') => 12.56
money_to_val('12.56$') => 12.56
money_to_val('USD 12.56') => 12.56
maybe even
money_to_val('12 dollars, 56 cents') => 12.56
Probably what I need to cover 95% of the cases is to remove all the
non-digits except a delimiter (, or .) I guess. Or not?
Thanks,
Peter
__
http://www.rubyra...
1 Answer
Thomas Hafner
1/24/2007 12:50:00 PM
0
Peter Szinek <peter@rubyrailways.com> wrote/schrieb <45B73C94.1010405@rubyrailways.com>:
> Probably what I need to cover 95% of the cases is to remove all the
> non-digits except a delimiter (, or .) I guess. Or not?
Attention to locales! At least these variants for 1234567.89 exist in
different countries:
1 234 567,89
1.234.567,89
1,234,567.89
1 234 567.89
1'234'567.89
1,234,567·89
(See <
http://de.wikipedia.org/wiki/Dezimaltrennz...
.)
Regards
Thomas
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
library to rurn money into nominal value?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password