aspose file tools*
The moose likes Java in General and the fly likes Converting Number to Word Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Converting Number to Word" Watch "Converting Number to Word" New topic
Author

Converting Number to Word

Ankita Jha
Ranch Hand

Joined: Sep 15, 2008
Posts: 55
Hello ranchers,

In my application i a need which will convert number to Word.
Problem is ,When i have whole number like (10000 or 2260) etc,it works properly.
Byt i have some number like 158.32 then it shld be read as "One hunderd fifty eight and thirty two paise" but it read the number as "Fifteen thousand eight hundred and thirty two"

Im pasting my code below.Any help wil be appreciated.Thanks in advance.
>
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

One problem in your code what I could notice is in


I have not went through your entire code but probably calling the convertNumber function twice might solve your requirement




Swastik
Ankita Jha
Ranch Hand

Joined: Sep 15, 2008
Posts: 55
Thanks Swastik Dey
Got it working
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 928

program can be made much more simpler:

eg:


so units[4] would return "Four", I dont see why you require so many switch cases etc.


My Website: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Converting Number to Word