Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
var
theNum longInt
Snum string
textNum string
teenSwitch number
endvar
teenSwitch = 0
theNum = startNum.value
textNum = "Zero"
Snum = string(theNum); convert to string
if sizeEx(theNum) = 4 ; deals with thousands
then textNum = getNum(Snum.substr(1,1),"one")+" Thousand"
if getNum(Snum.substr(2,1),"one") = "Zero"
then textNum = textNum
else textNum = textNum+" "+getNum(Snum.substr(2,1),"one")+" Hundred"
endif
if getNum(Snum.substr(3,1),"ten") = "Zero"
then textNum = textNum
endif
if getNum(Snum.substr(3,1),"ten") = "One"
then textNum = textNum
teenSwitch = 1
endif
if teenSwitch = 1
then textNum = textNum+" "+getNum(Snum.substr(4,1),"teen")
numText.value = textnum
return
endif
if teenSwitch = 0
then if getNum(Snum.substr(3,1),"ten") = "Zero"
then textNum = textNum
else textNum = textNum+" "+getNum(Snum.substr(3,1),"ten")
endif
endif
if getNum(Snum.substr(4,1),"one") = "Zero"
then textNum = textNum
else textNum = textNum+" "+getNum(Snum.substr(4,1),"one")
endif
endif
numText.value = textnum
method getNum(inNum string, pos string) string
switch
case inNum = "1" and pos = "one":
return "One"
case inNum = "2" and pos = "one":
return "Two"
case inNum = "3" and pos = "one":
return "Three"
case inNum = "4" and pos = "one":
return "Four"
case inNum = "5" and pos = "one":
return "Five"
case inNum = "6" and pos = "one":
return "Six"
case inNum = "7" and pos = "one":
return "Seven"
case inNum = "8" and pos = "one":
return "Eight"
case inNum = "9" and pos = "one":
return "Nine"
case inNum = "0" and pos = "one":
return "Zero"
endSwitch
switch
case inNum = "1" and pos = "ten":
return "One"
case inNum = "2" and pos = "ten":
return "Twenty"
case inNum = "3" and pos = "ten":
return "Thirty"
case inNum = "4" and pos = "ten":
return "Forty"
case inNum = "5" and pos = "ten":
return "Fifty"
case inNum = "6" and pos = "ten":
return "Sixty"
case inNum = "7" and pos = "ten":
return "Seventy"
case inNum = "8" and pos = "ten":
return "Eighty"
case inNum = "9" and pos = "ten":
return "Ninety"
case inNum = "0" and pos = "ten":
return "Zero"
endSwitch
switch
case inNum = "1" and pos = "teen":
return "Eleven"
case inNum = "2" and pos = "teen":
return "Twelve"
case inNum = "3" and pos = "teen":
return "Thirteen"
case inNum = "4" and pos = "teen":
return "Fourteen"
case inNum = "5" and pos = "teen":
return "Fifteen"
case inNum = "6" and pos = "teen":
return "Sixteen"
case inNum = "7" and pos = "teen":
return "Seventeen"
case inNum = "8" and pos = "teen":
return "Eighteen"
case inNum = "9" and pos = "teen":
return "Nineteen"
case inNum = "0" and pos = "teen":
return "Zero"
endSwitch
return ""
endMethod