- <%
- ''ces fonctions sont valable sur un nombre base 36 sur 3 positions :
-
- ''déclaration de 2 tableaux :
-
- dim Tb1 ()
- dim Tb2 ()
- Redim Tb1 (26)
- Redim Tb2 (26)
- Dim lettre
-
- 'remplir tableau TB1 lettre TB2 Nombre
-
- y = 65
- i = 1
- For i = 1 to 26
- Tb1(i) = Chr(y) 'renvoie la valeur en donnant le code ascii
- y = y + 1
- Next
-
- y = 10
- For i = 1 to 26
- Tb2 (i) = y
- y = y + 1
- Next
-
- ''fin tableau
-
- ''de base 36 en base 10
-
- Public function base36 (nbr)
- dim rslt, cpt, i
-
- rslt = 0
- cpt = 2
-
- for z = 1 to 3
- lettre = mid(Cstr(nbr),z,1)
- if Isnumeric(lettre) = false then
- i = 1
- while Tb1(i) <> lettre and i <= 26
- i = i + 1
- wend
- rslt = rslt + Tb2(i)*36^cpt
- else
- rslt = rslt + lettre*36^cpt
-
- end if
- cpt = cpt - 1
- Next
-
- base36 = rslt
-
- end function
-
-
-
- ''de base 10 en base 36
-
- Public function base10 (nbr)
- dim rslt, tmp, i
-
- rslt = ""
-
- while int(nbr mod 36) >= 1
-
- if (nbr mod 36) >= 10 then
- i = 1
- while not Tb2(i) = (nbr mod 36) and i<= 26
- i = i + 1
- wend
- tmp = Tb1(i)
-
- else
- tmp = (nbr mod 36)
- end if
-
- rslt = tmp&rslt
-
- nbr = int(nbr/36)
-
- wend
-
- base10 = rslt
-
- end function
-
- %>
-
-
<%
''ces fonctions sont valable sur un nombre base 36 sur 3 positions :
''déclaration de 2 tableaux :
dim Tb1 ()
dim Tb2 ()
Redim Tb1 (26)
Redim Tb2 (26)
Dim lettre
'remplir tableau TB1 lettre TB2 Nombre
y = 65
i = 1
For i = 1 to 26
Tb1(i) = Chr(y) 'renvoie la valeur en donnant le code ascii
y = y + 1
Next
y = 10
For i = 1 to 26
Tb2 (i) = y
y = y + 1
Next
''fin tableau
''de base 36 en base 10
Public function base36 (nbr)
dim rslt, cpt, i
rslt = 0
cpt = 2
for z = 1 to 3
lettre = mid(Cstr(nbr),z,1)
if Isnumeric(lettre) = false then
i = 1
while Tb1(i) <> lettre and i <= 26
i = i + 1
wend
rslt = rslt + Tb2(i)*36^cpt
else
rslt = rslt + lettre*36^cpt
end if
cpt = cpt - 1
Next
base36 = rslt
end function
''de base 10 en base 36
Public function base10 (nbr)
dim rslt, tmp, i
rslt = ""
while int(nbr mod 36) >= 1
if (nbr mod 36) >= 10 then
i = 1
while not Tb2(i) = (nbr mod 36) and i<= 26
i = i + 1
wend
tmp = Tb1(i)
else
tmp = (nbr mod 36)
end if
rslt = tmp&rslt
nbr = int(nbr/36)
wend
base10 = rslt
end function
%>