Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / November 2006

Tip: Looking for answers? Try searching our database.

"Four" to 4

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bubba - 21 Nov 2006 16:09 GMT
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
Spam Catcher - 21 Nov 2006 17:57 GMT
> 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?
lord.zoltar@gmail.com - 21 Nov 2006 18:16 GMT
> > 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
[quoted text clipped - 3 lines]
>
> 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... ;)
Tom Leylan - 21 Nov 2006 20:44 GMT
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/microsoft.public.dotnet.languages.vb/browse_frm/t
hread/f94daee1c21157f5/0f55f44be05b50b5?lnk=st&q=%22Looping+for+user+input+in+a+
textbox%22&rnum=1#0f55f44be05b50b5


> 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
Cor Ligthert [MVP] - 21 Nov 2006 22:30 GMT
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

> 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
[quoted text clipped - 17 lines]
>> ex. "Four" to 4 or "Forty-Five" to 45
>> Thank you

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.