-
-
Save RayMPerry/cf0d91b0858902a09673bd9f193a2db4 to your computer and use it in GitHub Desktop.
Chinese Numerals
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
sub MAIN($number = 14282) { | |
my $numerals = <零 一 二 三 四 五 六 七 八 九>; | |
my $places = $number.polymod(10, 10, 10, 10).reverse; | |
my Str $numbers = join "", do for ^5 -> $index { | |
my Int $number = $places[$index]; | |
next if $number == 0; | |
$numerals[$number] ~ <万 千 百 十>[$index]; | |
} | |
$numbers.say; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment