Convert NSString to int
|
|
| Example code how to convert NSString to int and how to convert int to NSString. |
|
Using: Xcode 4.2.1 Mac OS X 10.7.2 Cocoa |
| From NSString to int |
|
int intValue; NSString *strValue = @"0"; intValue = [strValue intValue]; |
| intValue should be 0 |
| From int to NSString |
|
int intValue = 1; NSString *strValue = @""; strValue = [NSString stringWithFormat:@"%i",intValue]; |
|
strValue should be 1 |
Comments
Post new comment