Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Numeric Conversion
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00166019
Message ID:
00166473
Views:
20
>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!
Previous
Reply
Map
View

Click here to load this message in the networking platform