objective-c:如何将int转换为NSString

Ily*_*ski 3 objective-c

我使用以下代码来获取字符串中第一个字母的字母数字:

toupper([ my_string characterAtIndex: 0 ] ) - 'A'
Run Code Online (Sandbox Code Playgroud)

我需要做一个反向任务 - 将字母数字转换为NSString.

这样做的最佳方法是什么?

先感谢您.

Ada*_*eld 11

用途stringWithFormat::

// 0 ==> @"A", 25 ==> @"Z"
NSString *str = [NSString stringWithFormat:@"%c", theCharIndex + 'A'];
Run Code Online (Sandbox Code Playgroud)

编辑包含字符串标识符@