Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/florian-obernberger/spell_out_numbers

A simple package for dart and flutter which converts numbers to English words with more languages to come!
https://github.com/florian-obernberger/spell_out_numbers

dart flutter

Last synced: 7 days ago
JSON representation

A simple package for dart and flutter which converts numbers to English words with more languages to come!

Awesome Lists containing this project

README

        

# Spell Out Numbers

[![License](https://img.shields.io/github/license/florian-obernberger/spell_out_numbers)](./LICENSE)
[![Dart](https://github.com/florian-obernberger/spell_out_numbers/actions/workflows/dart.yml/badge.svg)](https://github.com/florian-obernberger/spell_out_numbers/actions/workflows/dart.yml)

## Features

Writes put the name of a number given in different languages.
Currently only English is supported, but in the future I will
add more languages. If anyone is interested in helping me with
that, feel free to contact me / open an issue.

## Language Support

- [x] English
- [ ] German / Deutsch
- [ ] Spanish / Español

## Usage

There is one abstract class (`LanguageNumberScheme`) that all
other classes inherit from. This class and all classes extending
this one provide amongst others the following methods and getters:

- `toWord(num number)`: converts the number given into words
- `num get maxNumber;`: the largest number supported by the scheme
- `int get maxDecimals;`: the maximum number of decimal values

## Examples

```dart
LanguageNumberScheme scheme = EnglishNumberScheme();

print(scheme.toWord(10));
// ten
```

```dart
LanguageNumberScheme scheme = EnglishNumberScheme();

print(scheme.toWord(-1398));
// minus one thousand three hundred ninety eight
```