我正在尝试将整数格式化为 2 个字符,即 01、02、03,而不是 1、2、3、4。
我已经进行了一些谷歌搜索,但找不到任何东西。 @"%d"可以更改为反射(reflect) 2 个字符吗?
timeArray = [[NSMutableArray alloc] init];
for (int i = 0; i < 25; i++){
NSString *timeValue = [NSString stringWithFormat:@"%d", i];
[timeArray addObject:timeValue];
NSLog(@"Time: %@", timeValue);
}
问候, 斯蒂芬
最佳答案
明白了!!!
@“%02d”
关于iphone - 将整数格式化为 2 位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3762119/