7

Possible Duplicate:
How to do string conversions in Objective-C?

I am trying to convert a user's guess into an integer. How do I do that?

0

1 Answer 1

22

This is trivial in Objective-C...

NSString *inputString = @"75";
int value = [inputString intValue];

You can also use floatValue, doubleValue or (I believe) even boolValue to convert an NSString to other types. Here is a page that lists some common tasks you may need to perform with strings;

http://borkware.com/quickies/one?topic=NSString

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.