OC语法--NSNumber对象 淡淡的烟草味﹌ 2022-06-18 03:46 115阅读 0赞 NSNumber对象用法: 点击(此处)折叠或打开 1. void test(void) 2. \{ 3. NSNumber \*myNumber, \*floatNumber,\*intNumber; 4. NSInteger myInt; 5. 6. intNumber = \[NSNumber numberWithInt:10\]; 7. myInt = \[intNumber integerValue\]; 8. NSLog(@"%li",myInt); 9. 10. myNumber = \[NSNumber numberWithLong:0xabced\]; 11. NSLog(@"%lx",\[myNumber longValue\]); 12. 13. floatNumber = \[NSNumber numberWithFloat:9\]; 14. NSLog(@"%g",\[floatNumber floatValue\]); 15. 16. if (\[intNumber isEqualToNumber:floatNumber\] == YES) \{ 17. NSLog(@"num are equal"); 18. \} else \{ 19. NSLog(@"num are not equal"); 20. \} 21. if (\[intNumber compare:floatNumber\] == NSOrderedAscending) \{ 22. NSLog(@"first number less than second"); 23. \} 24. \} <script>window.\_bd\_share\_config=\{"common":\{"bdSnsKey":\{\},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"\},"share":\{\}\};with(document)0\[(getElementsByTagName('head')\[0\]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)\];</script> 阅读(1066) | 评论(0) | 转发(0) | 0 上一篇:OC语法--常用结构体 下一篇:OC语法--NSString对象 相关热门文章 * Autodesk Maya 2014 for Mac ... * 将iphone手机中的数据导入三星... * IOS如何打包成ipa文件 * Mac OS上编译Mobile VLC for i... * UIPageViewController中翻页方... * [linux dhcp peizhi roc][] * [关于Unix文件的软链接][Unix] * [求教这个命令什么意思,我是新...][...] * [sed -e "/grep/d" 是什么意思...][sed -e _grep_d_ _...] * [谁能够帮我解决LINUX 2.6 10...][LINUX 2.6 10...] 给主人留下些什么吧!~~ 评论热议 [linux dhcp peizhi roc]: http://ask.chinaunix.net/question/785970 [Unix]: http://ask.chinaunix.net/question/785964 [...]: http://ask.chinaunix.net/question/785935 [sed -e _grep_d_ _...]: http://ask.chinaunix.net/question/785919 [LINUX 2.6 10...]: http://ask.chinaunix.net/question/785702
还没有评论,来说两句吧...