NumbersToLetters is a package that converts numbers to letters in multiple languages.
- Convert numbers to letters in multiple languages.
- Developers can add their own languages.
To use this package, add numbers_to_letters
as a dependency in your pubspec.yaml file.
dependencies:
numbers_to_letters: ^1.0.0
This is a simple usage example:
import 'package:numbers_to_letters/numbers_to_letters.dart';
void main() {
print(NumbersToLetters.toLetters('en', 1234)); // one thousand two hundred and thirty-four
}
you can change the word separator with separator setter
...
NumbersToLetters.separator = ' ';
...
Developers can add their own languages by extending the NumbersToLettersBase
class.
class NumbersToLettersCustom extends NumbersToLettersBase {
...
}
void main() {
NumbersToLetters.registerLanguage('custom', NumbersToLettersCustom());
...
print(NumbersToLetters.toLetters('custom', 1234));
}
- English
- French
- Spanish
- German
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Request a new language by creating a new class that extends NumbersToLettersBase
, write correponding tests and open a pull request. Then, add the language to the README.
I will be happy to merge it. add it to the package.
If this project help you reduce time to develop, you can give me a cup of coffee :) by give me a star.