codice:
<%
Public Function convertNumber(numero)
A1 = Array("","uno","due","tre","quattro","cinque","sei","sette","otto","nove","dieci","undici","dodici","tredici","quattordici","quindici","sedici","diciassette","diciotto","diciannove")
A2 = Array("","","vent","trent","quarant","cinquant","sessant","settant","ottant","novant")
A3 = Array("","","venti","trenta","quaranta","cinquanta","sessanta","settanta","ottanta","novanta")
A4 = Array("","cento","duecento","trecento","quattrocento","cinquecento","seicento","settecento","ottocento","novecento")
A5 = Array("","mille","duemila","tremila","quattromila","cinquemila","seimila","settemila","ottomila","novemila")
numero_s = ""
'SE NUMERO NON VALIDO
if len(numero) =< 0 or len(numero) > 4 then
numero_s = ""
end if
'SE NUMERO HA 1 CIFRA
if len(numero) = 1 then
numero_s = A1(numero)
end if
'SE NUMERO HA 2 CIFRE
if len(numero) = 2 then
' SE LA PRIMA CIFRA è UNO
if left(numero,1) = "1" then
numero_s = A1(numero)
else
' SE LA SECONDA CIFRA è ZERO
if right(numero,1) = "0" then
numero_s = A3(numero)
else
'SE LA SECONDA CIFRA è 1 o 8
if right(numero,1) = "1" or right(numero,1) = "8" then
numero_s = A2(left(numero,1))
else
numero_s = A3(left(numero,1))
end if
numero_s = numero_s & A1(right(numero,1))
end if
end if
end if
'SE NUMERO HA 3 CIFRE
if len(numero) = 3 then
primaCifra = left(numero,1)
numero_cent = A4(primaCifra)
numeroDecimale = right(numero,2)
' SE LA PRIMA CIFRA è UNO
if left(numeroDecimale,1) = "1" then
numero_s = numero_cent & A1(numeroDecimale)
else
' SE LA SECONDA CIFRA è ZERO
if right(numeroDecimale,1) = "0" then
numero_s = numero_cent & A3(numeroDecimale)
else
'SE LA SECONDA CIFRA è 1 o 8
if right(numeroDecimale,1) = "1" or right(numeroDecimale,1) = "8" then
numero_s = A2(left(numeroDecimale,1))
else
numero_s = A3(left(numeroDecimale,1))
end if
numero_s = numero_cent & numero_s & A1(right(numeroDecimale,1))
end if
end if
end if
'SE NUMERO HA 4 CIFRE
if len(numero) = 4 then
primaCifra = left(numero,1)
numero_mill = A5(primaCifra)
primaCifra = mid(numero,2,1)
numero_cent = A4(primaCifra)
numeroDecimale = right(numero,2)
' SE LA PRIMA CIFRA è UNO
if left(numeroDecimale,1) = "1" then
numero_s = numero_mill & numero_cent & A1(numeroDecimale)
else
' SE LA SECONDA CIFRA è ZERO
if right(numeroDecimale,1) = "0" then
numero_s = numero_mill & numero_cent & A3(numeroDecimale)
else
'SE LA SECONDA CIFRA è 1 o 8
if right(numeroDecimale,1) = "1" or right(numeroDecimale,1) = "8" then
numero_s = A2(left(numeroDecimale,1))
else
numero_s = A3(left(numeroDecimale,1))
end if
numero_s = numero_mill & numero_cent & numero_s & A1(right(numeroDecimale,1))
end if
end if
end if
convertNumber = numero_s
End Function
%>