笔记:long、longlong、int、float、NSString相互转换
程序员文章站
2022-04-09 18:55:15
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];
上一篇: Swift 产生 uuid
下一篇: 在动态库里获取动态库的模块句柄