Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
{-
Konverteerida numbrid vahemikust 0 < n < 1000000 inglise keelde
Näiteks:
? convert 345
three hundred and forty-five
? convert 308000
three hundred and eight thousand
? convert 369027
three hundred and sixty-nine thousand and twenty-seven
? convert 369401
three hundred and sixty-nine thousand four hundred and one
-}
units = ["one","two","three","four","five",
"six","seven","eight","nine"]
teens = ["ten","eleven","twelve","thirteen","fourteen",
"fifteen","sixteen","seventeen","eighteen","nineteen"]
tens = ["twenty","thirty","forty","fifty",
"sixty","seventy","eighty","ninety"]
convert2 = combine2 . digits2
digits2 n = (n `div` 10, n `mod` 10)
combine2 (0, u+1) = units !! u
combine2 (1, u) = teens !! u
combine2 (t+2, 0) = tens !! t
combine2 (t+2, u+1) = tens !! t ++ "-" ++ units !! u
convert3 = combine3 . digits3
digits3 n = (n `div` 100, n `mod` 100)
combine3 (0, t) = convert2 t
combine3 (h+1, 0) = units !! h ++ " hundred"
combine3 (h+1, t) = units !! h ++ " hundred and "
++ convert2 t
convert6 = combine6 . digits6
digits6 n = (n `div` 1000, n `mod` 1000)
combine6 (0, h) = convert3 h
combine6 (m, 0) = convert3 m ++ " thousand"
combine6 (m, h) = convert3 m ++ " thousand"
++ link h ++ convert3 h
where link h | h < 100 = " and "
| otherwise = " "
convert = convert6