笔记:long、longlong、int、float、NSString相互转换
程序员文章站
2022-08-31 12:26:08
NSString *string = @"123"; // 1.字符串转int int intString = [string intValue]; // 2.int转字符串 NSString *stringInt = [NSString stringWithFormat:@"%d",intStri... ......
nsstring *string = @"123"; // 1.字符串转int int intstring = [string intvalue]; // 2.int转字符串 nsstring *stringint = [nsstring stringwithformat:@"%d",intstring]; // 3.字符串转float float floatstring = [string floatvalue]; // 4.float转字符串 nsstring *stringfloat = [nsstring stringwithformat:@"%f",floatstring]; long longvalue = 104024; // 5.long 型转换字符串 nsnumber *longnumber = [nsnumber numberwithlong:longvalue]; nsstring *longstr = [longnumber stringvalue]; // 6.long long 型转换字符串 nsnumber *longlongnumber = [nsnumber numberwithlonglong:longvalue]; nsstring *longlongstr = [longlongnumber stringvalue]; //7.字符串转long [str longlongvalue];
上一篇: asp.net动态添加控件学习
下一篇: 如何用RSS订阅?