我想在 Objective C 中将 int
转换为 NSString
。
我该怎么做?
最佳答案
可以使用 @()
表达式将基元转换为对象。所以 shortest 方法是将 int
转换为 NSNumber
并使用 stringValue
获取字符串表示方法:
NSString *strValue = [@(myInt) stringValue];
或
NSString *strValue = @(myInt).stringValue;
关于objective-c - 如何将 int 转换为 NSString?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1372715/