博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
NSString与int和float以及NSInteger的相互转换
阅读量:6973 次
发布时间:2019-06-27

本文共 571 字,大约阅读时间需要 1 分钟。

  hot3.png

NSString *tempA = @"123";

NSString *tempB = @"456";

// 1,字符串拼接

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

//2,字符转NSInteger      NSInteger k = [newString integerValue];

//2,NSInteger字符      NSString *s = [NSString stringWithFormat:@"%ld",k];

//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];

转载于:https://my.oschina.net/c1z2p3/blog/176280

你可能感兴趣的文章
New Concept English three (56)
查看>>
for 循环
查看>>
lamp+nginx代理+discuz+wordpress+phpmyadmin搭建
查看>>
Hash(LCP) || 后缀数组 LA 4513 Stammering Aliens
查看>>
python全栈开发 * 进程之间的通信,进程之间数据共享 * 180726
查看>>
[HNOI2007]分裂游戏
查看>>
JSON数据传递
查看>>
Android Studio 小技巧(2):AS中Button文字默认大写的问题
查看>>
用Python将word文件转换成html(转)
查看>>
移动widget开发
查看>>
http协议相关参考资料
查看>>
牛客寒假6-B.煤气灶
查看>>
[Java基础]常用IO操作之字节流
查看>>
TRUNC函数的用法
查看>>
嗯,农民伯伯的2014就是这些
查看>>
预约系统(八) 管理页面--会议室管理
查看>>
HDU 1286(欧拉函数||筛选法)
查看>>
Nginx初识
查看>>
android -- 蓝牙 bluetooth (五)接电话与听音乐
查看>>
vue 组件开发 props 验证
查看>>