Convert NSString to int
NSString *aNumberString = @"123"; int i = [aNumberString intValue];
Convert int to NSString
int aNumber = 123; NSString *aString = [NSString stringWithFormat:@"%d", aNumber];
Objective-C 字符串与数值互相转换
时间: 2024-11-05 11:44:10
Convert NSString to int
NSString *aNumberString = @"123"; int i = [aNumberString intValue];
Convert int to NSString
int aNumber = 123; NSString *aString = [NSString stringWithFormat:@"%d", aNumber];
Objective-C 字符串与数值互相转换