No Numerals. Swift | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

No Numerals. Swift

Please comment my code. What are another ways to solve a problem? https://code.sololearn.com/cMfm6Skkqb2N/?ref=app

18th Nov 2020, 4:25 PM
Uldfang
 Uldfang - avatar
3 Answers
+ 3
I don't know Swift but I can give you the Idea and you make it happen. Create a 2D array with "zero", "one", "tow" and so on. Then you read the input and for every number N you find you print array[ N ]
18th Nov 2020, 4:45 PM
Davide
Davide - avatar
+ 1
The official way to do this in Swift is using NumberFormatter (from Foundation). https://code.sololearn.com/cH3pZ4Z6n8bt/?ref=app
17th Jul 2021, 9:38 AM
Pawel Zabinski
Pawel Zabinski - avatar
0
https://code.sololearn.com/cv26ea7wjEYP/?ref=app I accually made a code for it in java. I know it isn't swift but you can always try making a replica in swift by using the arrays and making a way to find if the input contains the numbers then replace it with the value in the array. and last but not least, print it out.
19th Nov 2020, 3:50 AM
pNK
pNK - avatar