https://github.com/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.
https://github.com/markrickert/mrcurrencyround
Last synced: about 1 year ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/markrickert/mrcurrencyround
- Owner: markrickert
- License: mit
- Created: 2011-11-24T13:51:00.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2014-07-14T15:28:20.000Z (almost 12 years ago)
- Last Synced: 2025-05-06T22:08:49.360Z (about 1 year ago)
- Language: Objective-C
- Homepage:
- Size: 156 KB
- Stars: 14
- Watchers: 1
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](http://cocoapods.org/), 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)
```