前段時間遇到了int型數據轉換成string的要求,找了很久,在別人空間看到,轉過來,備用 orm
NSString *tempA = @"123"; 字符串
NSString *tempB = @"456"; string
1,字符串拼接 it
NSString *newString = [NSString stringWithFormat:@"%@%@",tempA,tempB]; float
2,字符轉int 數據
int intString = [newString intValue]; 時間
3,int轉字符 字符
NSString *stringInt = [NSString stringWithFormat:@"%d",intString]; new
4,字符轉float
float floatString = [newString floatValue];
5,float轉字符
NSString *stringFloat = [NSString stringWithFormat:@"%f",intString];