TestsTested | ✓ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Hiroki Akiyama (akiroom), akiroom.
Convert NSNumber(Integer) to NSString with metric prefix.
To run the example project, clone the repo, and run pod install
from the Example directory first.
AXMetricPrefixFormatter *metricPrefixFormatter = [[AXMetricPrefixFormatter alloc] init];
NSLog(@"%@", [metricPrefixFormatter stringWithMetricPrefixFromNumber:@(0)]);
NSLog(@"%@", [metricPrefixFormatter stringWithMetricPrefixFromNumber:@(1200)]);
NSLog(@"%@", [metricPrefixFormatter stringWithMetricPrefixFromNumber:@(100834923)]);
NSLog(@"%@", [metricPrefixFormatter stringWithMetricPrefixFromNumber:@(10500000000)]);
NSLog(@"%@", [metricPrefixFormatter stringWithMetricPrefixFromNumber:@(1230000000000)]);
NSLog(@"%@", [metricPrefixFormatter stringWithMetricPrefixFromNumber:@(-10200)]);
/*
Console:
0
1.2K
101M
10.5B
1.23T
-10.2K
*/
Hiroki Akiyama, [email protected]
AXMetricPrefixFormatter is available under the MIT license. See the LICENSE file for more info.