function a($)
dim $s, $t[9], $o[9], $d[9], $w[2], $f, $r, $l, $n
$o = "zero","one","two","three","four","five","six","seven","eight","nine"
$d = $ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"
$t = "","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"
$a = ""
if $ + 0 = $
select
case $ < 10
$w = "","",$o[$]
case $ < 20
$w = "","",$d[$ - 10]
case 1
$r = $ mod 10
$f = int($ / 10)
$w = $t[$f],"-",iif($r = 0,"",$o[$r])
endselect
while not($w[0] = "" and $w[2] = "four")
$l = len($w[0]) + len($w[2])
if $w[0] = ""
if Ascan($d,$w[2]) < 0
$n = Ascan($o,$w[2])
else
$n = Ascan($d,$w[2]) + 10
endif
else
$n = Ascan($t,$w[0]) * 10 + iif($w[2]="",0,Ascan($o,$w[2]))
endif
$a = $a + $n + " is " + $l + ". "
if $l < 10
$w = "","",$o[$l]
else
$w = "","",$d[$l-10]
endif
loop
$a = $a + "4 is magic."
else
if Instr($,"-")
$s="-"
$w = split($,$s)
else
if Instr($," ")
$s=" "
$w = split($,$s)
else
$s=""
$w = $s,$
endif
endif
redim preserve $w[2]
$w[2]=$w[1]
$w[1]=$s
while not($w[0] = "" and $w[2] = "four")
$l = len($w[0]) + len($w[2])
if $l < 10
$n = $o[$l]
else
$n = $d[$l-10]
endif
$a = $a + join($w,"") + " is " + $n + ". "
if $l < 10
$w = "","",$o[$l]
else
$w = "","",$d[$l-10]
endif
loop
$a = $a + "four is magic."
endif
endfunction