Re: Question About Z-Level Number Thingie

new topic     » goto parent     » topic index » view thread      » older message » newer message

C. K. Lester wrote:
>I want to be able to use what I am temporarily calling "Z-Level"
numbering,
>where it's like hexadecimal but it uses the whole alphabet (up to 'Z', y=
ou
>see). Whereas hexadecimal stops at F=3D15, z-decimal stops at Z =3D 36
(starting
>with 0=3D0 and workin' yer way up).
>

Actually, Z would be 35  tongue

I don't know if Lucius' suggestion helped you, but here is a short functi=
on
which converts a decimal integer to any base between 2 and 36...

sequence char, out_str
char =3D "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
out_str =3D ""

function convert_base(integer num, integer base)
    if num >=3D base then
        out_str =3D convert_base(floor(num/base), base) & char[remainder(=
num,
base)+1]
    else
        out_str &=3D char[num+1]
    end if
    return out_str
end function

- Colin

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu