Convert NSString to NSInteger?
问题 I want to convert string data to NSInteger . 回答1: If the string is a human readable representation of a number, you can do this: NSInteger myInt = [myString intValue]; 回答2: [myString intValue] returns a cType "int" [myString integerValue] returns a NSInteger . In most cases I do find these simple functions by looking at apples class references, quickest way to get there is click [option] button and double-click on the class declarations (in this case NSString ). 回答3: I've found this to be the