How to convert NSDecimal to NSString with custom format
How can开发者_运维技巧 I show NSDecimal with custom format? Something like "%.2f" or "%.4f". NSDecimalString just throws away zeroes (e.g 4.10 becomes 4.1).
[NSString stringWithFormat:@"%.2f", [[NSDecimalNumber decimalNumberWithDecimal:myDecimal] doubleValue]]
Alternatively, look into NSNumberFormatter.
精彩评论