7 releases

0.1.6 Feb 10, 2023
0.1.5 Jan 5, 2023

#1 in #said

MIT/Apache

13KB
291 lines

Yet another terbilang 🤷

Converts u64 number to said Indonesian.

use yaterbilang as terbilang;

assert_eq!(terbilang::from(0), "nol");
assert_eq!(terbilang::from(11), "sebelas");
assert_eq!(terbilang::from(32), "tiga puluh dua");
assert_eq!(terbilang::from(998), "sembilan ratus sembilan puluh delapan");

This is just a brute force way to exhaustively determine all the possible outcome. Given that the possible input is finite and deterministic, we think that this one should not differ much in terms of performance-wise when compared to other "smarter" solution. It just works.

The source code should also be relatively dead simple and verbose to ease any future changes.

Install

Simply do cargo add yaterbilang. For more instruction, please refer to the official crate page.

Notes

  • Version 0.1.5 supports up to 999.999.999.999 (triliun).

No runtime deps