By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,302 Members | 1,812 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,302 IT Pros & Developers. It's quick & easy.

"Four" to 4

P: n/a
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

Nov 21 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"Bubba" <na**********@hotmail.comwrote in
news:ea**************@TK2MSFTNGP06.phx.gbl:
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?
Nov 21 '06 #2

P: n/a

Spam Catcher wrote:
"Bubba" <na**********@hotmail.comwrote in
news:ea**************@TK2MSFTNGP06.phx.gbl:
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?
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... ;)

Nov 21 '06 #3

P: n/a
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/micro...55f44be05b50b5

"Bubba" <na**********@hotmail.comwrote in message
news:ea**************@TK2MSFTNGP06.phx.gbl...
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

Nov 21 '06 #4

P: n/a
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

"Tom Leylan" <ge*@iamtiredofspam.comschreef in bericht
news:ez**************@TK2MSFTNGP04.phx.gbl...
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/micro...55f44be05b50b5

"Bubba" <na**********@hotmail.comwrote in message
news:ea**************@TK2MSFTNGP06.phx.gbl...
>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


Nov 21 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.