NSString *a = @"234";
int abc = [a intValue];
…..
doubleValue;
floatValue;
boolValue;
integerValue;
-----------------------------------------------------
NSInteger转换为int:
NSInteger myInteger = 32;
int myInt = myInteger;
NSLog(@"myInt = %d", myInt);
附录:
#if __LP64__ || TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64
typedef long NSInteger;
#else
typedef int NSInteger;
#endif
Objective-C基本数据类型转换
本文介绍了Objective-C中NSString到int的基本转换方法,并演示了如何将NSInteger类型转换为int类型。通过实例代码展示了NSString转int的过程及NSInteger与int之间的转换。
723

被折叠的 条评论
为什么被折叠?



