"Four" to 4

  • Thread starter Thread starter Bubba
  • Start date Start date
B

Bubba

Has anyone ever run into a problem converting a text version of number to
it's whole number equivalent? If so, can someone please post an example in
2005 of how this is handled?
ex. "Four" to 4 or "Forty-Five" to 45
Thank you
 
Has anyone ever run into a problem converting a text version of number
to it's whole number equivalent? If so, can someone please post an
example in 2005 of how this is handled?
ex. "Four" to 4 or "Forty-Five" to 45
Thank you

I believe you'll need to do text parsing. Perhaps with Regular Expressions?
 
Spam said:
I believe you'll need to do text parsing. Perhaps with Regular Expressions?

Well, there will probably more involved then just regular expressions.
And what about numbers with more than one text representation? For
example, "1800" could be "eighteen-hundred" or "eighteen hundred" or
"one thousand, eight hundred" or "one thousand and eight hundred" (of
course the ", " and " and" are interchangable here).... ok that example
was a little too simple. I'd have to try harder to come up with better
ones.

An interesting problem though. Would also be cool to translate Roman
numerals. eg.
NumConvert("IV") returns "Four" or "4" or "...." or "{4 in some other
number system}"...
Maybe if I have time later today I'll hack out something... ;)
 
This has been done countless times in the last few decads and you should be
able to find examples on the Internet. You may or may not find one in
VB.Net but you should be able to convert the few lines of Java, VB6 or what
have you if you don't locate one in your language of choice.

As for Roman Numeral conversion (somebody else posted about it) I would
suggest reading a thread from 2003. It is a great esample of how one guy
learned by constant refining of the process. Cor was in on it along with
Fergus Cooney (whatever happened to him Cor?) and me along with a few
others. Before you grab the code, read the thread and note that I have a
completed set of functions near the end of the thread so you shouldn't grab
the interim versions.

Search for "Looping for user input in a textbox" or use this link:
http://groups.google.com/group/micr...r+input+in+a+textbox"&rnum=1#0f55f44be05b50b5
 
Tom,

I never knew what happened with Fergus, I have mailed him but it was a kind
of dead address.

I have asked this often off and online on Nick (Nak) with who he was often
talking in this newsgroup. But never got an answer from Nick as well. (A
very decent guy Nak these days).

Cor
 
Back
Top