如何将NSInteger转换为NSString数据类型? [英] How do I convert NSInteger to NSString datatype?

查看:162
本文介绍了如何将NSInteger转换为NSString数据类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将 NSInteger 转换为 NSString 数据类型?

How does one convert NSInteger to the NSString datatype?

我尝试了以下操作,其中月份为 NSInteger

I tried the following, where month is an NSInteger:

  NSString *inStr = [NSString stringWithFormat:@"%d", [month intValue]];


推荐答案

NSIntegers不是对象,你将它们转换为 long ,以匹配当前的64位架构的定义:

NSIntegers are not objects, you cast them to long, in order to match the current 64-bit architectures' definition:

NSString * inStr = [NSString stringWithFormat:@%ld,(长)月];

这篇关于如何将NSInteger转换为NSString数据类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆