首页 > 其他 > 详细

oc的基本数据的转换

时间:2014-01-21 15:28:21      阅读:403      评论:0      收藏:0      [点我收藏+]

-(int)intValue;//字符串转换为整型;

-(float)floatValue;//字符串转换为浮点型.

-(BOOL)boolValue;//字符串转换为布尔值类型.

{NSInteger integerNumber = 888;

NSString * string = [NSString stringWithFormat:@"%d",integerNumber]; }//整型转换为字符串

NSNumber和NSValue//将基本数据类型转换为数值对象

+(NSNumber *)numberWithChar:(char)value;

+(NSNumber *)numberWithInt:(int)Value;

+(NSNumber *)numberWithFloat:(float)Value;

+(NSNumber *)numberWithBool:(bool)Value;


-(char)charValue;//把已经封装好的NSNumber的对象转换为基本数据类型char;

-(int)intValue;

-(float)floatValue;

-(BOOL)boolValue;

-(NSString *)stringValue;


NSValue的一些用法

+(NSValue *)valueWithPoint:(CGPoint)point;

+(NSValue *)valueWithSize:(CGSize)size;

+(NSValue *)valueWithRect:(CGRect)rect;

-(CGPoint)pointValue;

-(CGSize)sizeValue;

-(CGRect)rectValue;

转载请注明本文源地址:http://blog.csdn.net/u013082522/article/details/18562659



oc的基本数据的转换

原文:http://blog.csdn.net/u013082522/article/details/18562659

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!