Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

alias numconv {

%u = return
var %i,%r,%l one 2o 3ree 4ur 5ve 6 7 8t 9 ten elen 2el 3ir 4ur 5f 6 7 8 9 2en 3
9,%t 3ousand m b tr quadr qut xt pt oct non un duo tre quattuor qu x
$chr(44))
if %n !isnum 0- %u $iif(%n,invalid)
%n = $gettok(0 $+ %n,1,46)
while %n {
var %p $or($right(%n,3)),%k
while %p {
%x = $left(%p,1)
if ($len(%p) > 2) %k = $g(%l,%x)
elseif %x {
if ($len(%p) > 1) %k = %k $g(%l,$iif(%x = 1,%p,%x +18))
elseif (!$regex(%k,|)) %k = $+(%k,$iif( isin %k,-,$chr(32)),$g(%l,%x))
}
%p = $mid(%p,2)
}
%r = %k $iif(%i && %k,$g(%t,%i)) %r
%n = $left(%n,-3)
inc %i
}
%u $iif(%r,$replace(%r,,teen,,dec,,illion,,hundred,,ty,8,eigh,3,th,2,tw,4,fo,5,fi,9
ne,7,n,6,six,,ve,,se,,in),zero)
}
alias g %u $gettok($1,$calc($2),32)

You might also like