markrickert / MRCurrencyRound

A simple NSNumber class extension that provides better formatting for currency. Use this to correctly round an NSNumber to the 2nd decimal point based on standard "round half-up" methodology in order to calculate tax and percentages of currency, etc.
MIT License
15 stars 4 forks source link

Why not use NSDecimalNumber and the NSRoundingBehavior classes? #2

Open MosheBerman opened 11 years ago

MosheBerman commented 11 years ago

Isn't this built in to the iOS SDK?

markrickert commented 11 years ago

Yeah, I bet i could simplify it a bit using the NSDecimalNumber instead of an NSNumber and an NSNumberFormatter, however, I'm no looking to turn 12.456 into 12,46, I'm looking to turn it into €12,46 (or something similar) so I need to use the NSLocale to get the currency symbol and append it wherever it needs to go on the number.

I'd love to see how you would improve this using NSDecimalNumber! Please send me a pull request!