Number -> String? (Java)

Maui

Newbie
Joined
Jul 6, 2004
Messages
390
Reaction score
0
Hey guys. I'm still working on learning Java, but I know a fair amount. The problem is, I'm needing to convert a double like 1042.04 to a string of, in this example, "one thousand forty two AND four". (Think of when you're writing a check) Unfortunately all my searches only told me how to convert 1042.04 to "1042.04" :P

My best guess right now is a switch statement for "one", "two", etc. for each time you'd have just the name of the number (e.g. the ones, hundreds, thousands, hundred thousands) and some other switch statement for the "twenty, thirty" etc., then yet another for the teens (fourteen, fifteen) and then a final check for eleven and twelves. I'm *really* hoping there's an easier way to do this. Can anyone help me? ;(
 
Okay, with much more Googling I found a way to do it which was similar in certain aspects to my idea, but a lot better in others. In case you're interested:
Other Way
 
Back
Top