View Full Version : Getting a number from a string
Duke Leto
Jan 28, 2009, 09:33 PM
How is it possible to get a number value from a string that the user inputted?
Jeremy1026
Jan 28, 2009, 10:03 PM
How is it possible to get a number value from a string that the user inputted?
What do you want to do with that number? I can think of a few ways to grab that value, but they are specific to different situations.
Duke Leto
Jan 28, 2009, 10:05 PM
Do a calculation and set a UISlider's value to that number.
Jeremy1026
Jan 28, 2009, 10:10 PM
Do a calculation and set a UISlider's value to that number.
Are the inputting the number via a textfield?
Duke Leto
Jan 28, 2009, 10:12 PM
Yes.
Jeremy1026
Jan 28, 2009, 10:19 PM
Yes.
You can just use
[textField.text integerValue]
to grab the numeral value of the field. No need to pass it to a string.
Duke Leto
Jan 28, 2009, 10:21 PM
Awesome! Thank you for the help! I as looking at the docs for NSNumberFormatter .. :o.
Jeremy1026
Jan 28, 2009, 10:36 PM
Awesome! Thank you for the help! I as looking at the docs for NSNumberFormatter .. :o.
No problem man.
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.