- Home /
Question is off-topic or not relevant
Turning Int To String (50 > "Fifty")
How would I go about turning an int such as 55 into string "Fifty Five" and being able to compare the two?
in what language? english, chinese, spanish? the best bet is simply to have an array of strings and use those. it's likely you have a limit of useful numbers.
Well thats what I originally was going to try, and I was going to try looping through the different strings and mix and match until they fit. Unfortunately, there were so many different variables involved in using that method. I can re-try and show you the code I have.
are you now saying you want to ALSO turn a string "fifty" back to an Int 50 ?
you're only hope would be to find a library that attempts to do that. really it has nothing to do with Unity.
you'd be much better asking on stackexchange. be sure to express the question clearly so that people know what you actually want to avoid any time waste
good luck!
Thanks, I was able to get it somewhat working. The code turns an int like 63 into "Six Three." I'll try and find a way around that.
As for turning it into a string you would only need to loop 0 - 9. Then take the first digit of the number entered compare it print out the string , repeat for the next digit until the end. I don't think that would be to hard.
Answer by franky303 · Sep 25, 2012 at 08:41 AM
You might use a C# Hashtable and store all the values predefined, say from 0-100. The hash can be the int, the text can be the value of the hashtable ...
Follow this Question
Related Questions
c# convert int to string 2 Answers
[SOLVED] Convert this line from string to int 1 Answer
Array - Convert Object into Int 5 Answers
Converting a string to an int 2 Answers
GUI.Label shows volume from a slider 3 Answers