Skip to content

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.

License

Notifications You must be signed in to change notification settings

markrickert/MRCurrencyRound

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

How to install:

If you're not using CocoaPods, you should be. Simply add pod 'MRCurrencyRound' to your Podfile

How to use:

After you've got the pod installed into your project's workspace, you can use the methods NSNumber.currencyRound and NSNumber.currencyString to return properly formatted currency objects.

Example:

NSNumber *example = [NSNumber alloc] initWithFloat:43.652443f];
NSLog(@"Currency String: %@", example.currencyString);
// Currency String: $43.65
// Or whatever your local currency format is (€43.65 or 43.65DKK)

About

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.

Resources

License

Stars

Watchers

Forks

Packages

No packages published