+ 1

How to convert numbers into the words...... Example: 128 is one hundred and twenty eight

task: The value only get the user and convert related string

24th Apr 2017, 2:23 PM
Manikandan
Manikandan - avatar
4 Antworten
+ 7
I'm not sure if there's an import for this, but to do it manually you will need to make a converter: * You need strings for all words from 1- 20, 30, 40, 50, 60, 70, 80, 90, 100, 1000 *You will also need "and" * Then you really just need to find a way to combine them accordingly. 21 = 20 + " " + 1. Basically you could take the first digit, if it's size is 2 it's just firstDigit*10 + lastDigit. (Where each string name is just the number, then grab that string accordingly). If it's in the hundreds, (length == 3) then take firstDigit + 100 + x + " and" + y. Note* when i say firstDigit + 100 + x etc.. I'm talking about the strings containing "one" + " hundred" + etc.. As to how to go about grabbing the correct string, I can't think of a way that's not hard coded off the top of my head. Hard code being just a bunch if/switch statements.
24th Apr 2017, 2:35 PM
Rrestoring faith
Rrestoring faith - avatar
+ 7
String one = "One"; String ten = " ten."; String hundred = " hundred"; When I say 1+100+10 what I really mean is: one+hundred+ten; which equals: One hundred ten.
24th Apr 2017, 3:55 PM
Rrestoring faith
Rrestoring faith - avatar
+ 1
i can't understand....but thanks ur solution
24th Apr 2017, 3:40 PM
Manikandan
Manikandan - avatar