iphone - 如何将 NSinteger 转换为字符串

标签 iphone objective-c

<分区>

我想在 objective-c 中将 int 转换为字符串,该怎么做。

我的代码。

for (i=0; i<=200; i=i+10) {
    // here i want to convet the value of i into string how to do this 

}   

提前致谢。

最佳答案

试试这个:

NSMutableString *myWord = [[NSMutableString alloc] init];
for (int i=0; i<=200; i=i+10) {
    [myWord appendString:[NSString stringWithFormat:@"%d", i]];
    //...
}
//do something with myWord...
[myWord release];

NSInteger 只是 32/64 位系统上 intlong 数据类型的 typedef .

关于iphone - 如何将 NSinteger 转换为字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3821495/

相关文章:

json - 使用逗号拆分 NSString

ios - 从库中选择视频上传错误

iphone - Web 服务器和游戏服务器有什么区别?

ios - UICollectionViewCell 内的 UIScrollView 不滚动

iphone - -[NSUserDefaults registerDefaults :]? 有什么用

iphone - 重新排序单元格后重新加载自定义 UITableViewCell

ios - 不兼容的 CoreData 存储是否总是会导致崩溃?

objective-c - WebView打开 '_blank'链接

objective-c - 如何复制数组?

ios - AFNetworking 和推送通知