Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Numeric Conversion
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00166019
Message ID:
00166473
Vues:
26
>I'm looking for a routine to convert a base-10 number to a base-36 number (0-9,A-Z). I need to create an incrementing counter in Base-36...or increment in base-10 and convert to base-36.

WARNING!! UNTRIED CODE AHEAD!!

I guess this could work:
FUNCTION BASE10TO36
LPARAMETER n10
LOCAL c36,nR
c36=""
DO WHILE n10>0
  nR = MOD(n10, 36)
  c36 = IIF(nR<10, STR(nR,1), CHR(ASC("A")+nR-10)) + c36 
  n10 = INT(n10 / 36)
ENDDO
RETURN c36
HTH!
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform