OC中字符串和基础变量之间的转换

1,字符串拼接

NSString *newString = [NSString stringWithFormat:@"%@%@",tempA,tempB];

 

2,字符转int

int intString = [newString intValue];

 

3,int转字符

NSString *stringInt = [NSString stringWithFormat:@"%d",intString];

 

4,字符转float

float floatString = [newString floatValue];

 

5,float转字符

NSString *stringFloat = [NSString stringWithFormat:@"%f",intString];

posted @ 2015-10-01 15:21  墨VS雪  阅读(495)  评论(0编辑  收藏  举报