Latest 1.0.0
Homepage https://github.com/dimat/DMNumberSpellOutFormatter
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

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.

Example

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 NumberSpellOutFormatter
if 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:

English

  • Numbering Year
  • Numbering
  • Numbering Verbose
  • Cardinal
  • Cardinal Verbose
  • Ordinal
  • Ordinal Verbose

Spanish

  • Numbering Year
  • Numbering
  • Cardinal Masculine
  • Cardinal Feminine
  • Ordinal Masculine Adjective
  • Ordinal Masculine Plural
  • Ordinal Masculine
  • Ordinal Feminine Plural
  • Ordinal Feminine

Italian

  • Numbering Year
  • Numbering
  • Cardinal Masculine
  • Cardinal Feminine
  • Ordinal Masculine
  • Ordinal Feminine

Russian

  • Numbering Year
  • Numbering
  • Cardinal Masculine
  • Cardinal Neuter
  • Cardinal Feminine
  • Cardinal Plural
  • Cardinal Masculine Genitive
  • Cardinal Neuter Genitive
  • Cardinal Feminine Genitive
  • Cardinal Plural Genitive
  • Cardinal Masculine Dative
  • Cardinal Neuter Dative
  • Cardinal Feminine Dative
  • Cardinal Plural Dative
  • Cardinal Masculine Accusative
  • Cardinal Neuter Accusative
  • Cardinal Feminine Accusative
  • Cardinal Plural Accusative
  • Cardinal Masculine Locative
  • Cardinal Neuter Locative
  • Cardinal Feminine Locative
  • Cardinal Plural Locative
  • Cardinal Masculine Ablative
  • Cardinal Neuter Ablative
  • Cardinal Feminine Ablative
  • Cardinal Plural Ablative
  • Ordinal Masculine
  • Ordinal Neuter
  • Ordinal Feminine
  • Ordinal Plural
  • Ordinal Masculine Genitive
  • Ordinal Neuter Genitive
  • Ordinal Feminine Genitive
  • Ordinal Plural Genitive
  • Ordinal Masculine Dative
  • Ordinal Neuter Dative
  • Ordinal Feminine Dative
  • Ordinal Plural Dative
  • Ordinal Masculine Accusative
  • Ordinal Neuter Accusative
  • Ordinal Feminine Accusative
  • Ordinal Plural Accusative
  • Ordinal Masculine Locative
  • Ordinal Neuter Locative
  • Ordinal Feminine Locative
  • Ordinal Plural Locative
  • Ordinal Masculine Ablative
  • Ordinal Neuter Ablative
  • Ordinal Feminine Ablative
  • Ordinal Plural Ablative

French

  • Numbering Year
  • Numbering
  • Cardinal Masculine
  • Cardinal Feminine
  • Ordinal Masculine Plural
  • Ordinal Masculine
  • Ordinal Feminine Plural
  • Ordinal Feminine

Installation

NumberSpellOutFormatter is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "NumberSpellOutFormatter"

Author

Dmitry Matyukhin, [email protected]

License

NumberSpellOutFormatter is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "NumberSpellOutFormatter",
    "version": "1.0.0",
    "summary": "Spell out numbers in any language",
    "description": "Allows to spell out numbers in different languages and with many options. Unlike the standard NSNumberFormatter itnalso supports ordinal numbers with any additional modes that are applicable for specific language, such as gendern(feminine and masculine) and grammatical cases.",
    "homepage": "https://github.com/dimat/DMNumberSpellOutFormatter",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Dmitry Matyukhin": "[email protected]"
    },
    "source": {
        "git": "https://github.com/dimat/DMNumberSpellOutFormatter.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "swift_version": "3.2",
    "source_files": [
        "NumberSpellOutFormatter/Classes/**/*"
    ],
    "public_header_files": "NumberSpellOutFormatter/Classes/*.h",
    "default_subspecs": "precompiled",
    "testspecs": [
        {
            "name": "Tests",
            "test_type": "unit",
            "source_files": "NumberSpellOutFormatter/Tests/*.swift",
            "pod_target_xcconfig": {
                "SWIFT_VERSION": "3.2"
            }
        }
    ],
    "subspecs": [
        {
            "name": "precompiled",
            "source_files": "icu4c-static-lib/include/**/*.h",
            "private_header_files": "icu4c-static-lib/include/**/*.h",
            "vendored_libraries": "icu4c-static-lib/lib/**/*.a",
            "header_mappings_dir": "icu4c-static-lib/include",
            "libraries": "c++",
            "pod_target_xcconfig": {
                "OTHER_LDFLAGS[arch=armv7]": "-l"c++" -l"icudata-arm" -l"icui18n-arm" -l"icuio-arm" -l"icuuc-arm"",
                "OTHER_LDFLAGS[arch=armv7s]": "-l"c++" -l"icudata-arm" -l"icui18n-arm" -l"icuio-arm" -l"icuuc-arm"",
                "OTHER_LDFLAGS[arch=arm64]": "-l"c++" -l"icudata-arm" -l"icui18n-arm" -l"icuio-arm" -l"icuuc-arm"",
                "OTHER_LDFLAGS[arch=i386]": "-l"c++" -l"icudata-simulator" -l"icui18n-simulator" -l"icuio-simulator" -l"icuuc-simulator"",
                "OTHER_LDFLAGS[arch=x86_64]": "-l"c++" -l"icudata-simulator" -l"icui18n-simulator" -l"icuio-simulator" -l"icuuc-simulator""
            }
        }
    ]
}

Pin It on Pinterest

Share This