Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Converting foreign numeric conventions to US

Reply
Thread Tools

Converting foreign numeric conventions to US

 
 
PoulsenL@capanalysis.com
Guest
Posts: n/a
 
      08-14-2003
I have a number of text fields with different ways of exressing currency.
Examples:

1 512,3 M
0.214,0 m
1 123 k
1,234,567
1.235.458,90
1,234,324 m (Where in this case m is to be conveyed as k. My only check is
to look at the final number and adjust by /1000 if greater than say 1
billion)
12,456 M [Tab] 67,897 k (where these numbers represent two different
scenarios)
1) [Tab] 0.456,9 M [CR] 2) [Tab] 45.879,0 M (where these numbers represent
two different scenarios)

plus a few other creative ways to express currency. I have written a re
that covers each case and, using matched groups, puts things back together
using the US convention but I was hoping for a cleaner more pythonic (read:
more readable) solution.

Thanks in advance,

Loren
--------------------------------------------------------------------------------------------------------------------
This email and any attachments contain information from CapAnalysis, LLC, which may be confidential and/or privileged. The information is intended to be for the use of the individual or entity named on this email. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this email is prohibited. If you receive this email in error, please notify us by reply email immediately so that we can arrange for the retrieval of the original documents at no cost to you.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
int to numeric numeric(18,2) ? jobs ASP .Net 2 07-22-2007 12:32 AM
Arithmetic overflow error converting numeric to data type numeric. darrel ASP .Net 4 07-19-2007 09:57 PM
Survey - implementing CRUD with "foreign name" instead of foreign key. H5N1 ASP .Net 0 05-03-2006 11:36 PM
check if string contains numeric, and check string length of numeric value ief@specialfruit.be C++ 5 06-30-2005 01:08 PM
Error converting data type varchar to numeric - stored procedures luna ASP .Net 1 02-06-2004 01:23 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57