Hi, how can I convert numbers into words without using arrays? or is it possible not to use arrays?
Printable View
Hi, how can I convert numbers into words without using arrays? or is it possible not to use arrays?
i think you should really use a list..
or check the API if theres any method that converts a number into a String/word
Integer.toString() converts an int to a string....after which you can stitch the strings together.
So, if I want to do the opposite, does String.toInteger () work?
Regards,
Shaun.
Integer.parseInt() is what you are looking for. If you are unsure that the String is an integer, be sure to validate it before, or catch any NumberFormatExceptions that could be thrown
see: how to convert string to int
hhaha i thought he was asking how to convert a number into a words LITERALLY
like 1 - one..! 1000 - one thousand.... deym...! :eek:
lol, no. I need to get the value of a string. In Olde BASIC (Sinclair, Commodore etc...) you would use something like VAL or VAL$. Ie, LET A=VAL "100" or LET B=VAL B$ would give you 100 or the literal value of B$ as long as B$ only contains numbers and not letters or other characters.
Regards,
Shaun.