| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Allows to spell out numbers in different languages and with many options. Unlike the standard NSNumberFormatter it also supports ordinal numbers with any additional modes that are applicable for specific language, such as gender (feminine and masculine) and grammatical cases.
To run the example project, clone the repo, and run pod install from the Example directory first.
Objective-C
NSLocale *selectedLocale = [NSLocale localeWithLocaleIdentifier:@"ru"];
DMNumberSpellOutFormatter *formatter = [[DMNumberSpellOutFormatter alloc] initWithLocale: selectedLocale];
[formatter setRuleSet:@"%spellout-ordinal-neuter-genitive"];
NSLog(@"%s", [formatter stringFromInt: 55]);Swift:
If there is use_frameworks! in Podfile, then add
import NumberSpellOutFormatterif let formatter = DMNumberSpellOutFormatter(locale: Locale(identifier: "ru")) {
formatter.setRuleSet("%spellout-ordinal-neuter-genitive")
print(formatter.string(from: 55)!)
}Output:
пятьдесят пятого
For English locale:
fifty-fifth
For example, here is the list of supported rule sets for some languages:
NumberSpellOutFormatter is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "NumberSpellOutFormatter"Dmitry Matyukhin, dimatu@gmail.com
NumberSpellOutFormatter is available under the MIT license. See the LICENSE file for more info.
| Back | FazBrowse Home | New Git URL |