Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Integer to word for the number

 
Angel Dobbs-Sciortino
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a class in the API that will convert an integer into the word for that number? Such as one, two, three, etc.
Angel
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Angel
Not that I know of in Java API.
Can't you just write your own class if you just have single digit numbers to manipulate? If you have 123 and you want to have "one hundred and twenty three" then its little difficult I guess but if you have one digit numbers then you can just define mapping right?
Regards
Maulin
 
Ransika deSilva
Ranch Hand
Posts: 524
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,
I wrote a method which does exactly what you want to do in a calculator assignment for my degree. At the moment I don't have it the at the place I am writting this anser. But if you want I will defenetely give you the coding when I go home. My coding translates 9 decimal numbers and 3 floating point numbers.
 
Angel Dobbs-Sciortino
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I would be interested in seeing that method. I've made my own method for now, but I would like to see another implementation of it.
Angel
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic