1
我想刪除xcode中兩位小數浮點的前導零。刪除浮點數前十進制的前導零
arrFraction = [[NSMutableArray alloc] init];
for (float fraction = .00; fraction <=.99; fraction+= .01) {
NSString *fractionString = [NSString stringWithFormat:@"%.2f%", fraction];
[arrFraction addObject:fractionString];
}
這導致的NSMutableArray與0.00
雖然0.99
我想是.00
值通過.99
可能重複的[從字符串中刪除第一個字符如果0](http://stackoverflow.com/questions/14031603/remove-first-character-from-string-if-0) – Kevin
可能重複[C - 如何隱藏在printf中導致零](http://stackoverflow.com/questions/2595738/c-how-to-hide-leading-zero-in-printf) – Sebastian