1.字符串相加连接的三种方法:
NSString* string; // 结果字符串
NSString* string1, string2; //已存在的字符串,需要将string1和string2连接起来
//方法1.
string = [NSString initWithFormat:@"%@,%@", string1, string2 ];
//方法2.
string = [string1 stringByAppendingString:string2];
//方法3 .
string = [string stringByAppendingFormat:@"%@,%@",string1, string2];
NSString* string1, string2; //已存在的字符串,需要将string1和string2连接起来
//方法1.
string = [NSString initWithFormat:@"%@,%@", string1, string2 ];
//方法2.
string = [string1 stringByAppendingString:string2];
//方法3 .
string = [string stringByAppendingFormat:@"%@,%@",string1, string2];
2,字符转int
int intString = [newString intValue];
3,int转字符
NSString *stringInt = [NSString stringWithFormat:@"%d",intString];
4,字符转float
5,float转字符
NSString *stringFloat = [NSString stringWithFormat:@"%f",intString];