Log In  

Right now, tostr(n) converts to decimal, and tostr(n,anything_except_nil_or_false) converts to hex.

Could it use the optional second arg as a base if it's a number? e.g.

>?tostr(255)
255
>?tostr(255,false)
255
>?tostr(255,true)
0x00ff.0000
>?tostr(255,16)
0x00ff.0000
>?tostr(255,10)
255
>?tostr(255,2)
0b0000000011111111.0000000000000000

For the sake of simplicity, you could limit it to the bases the parser can read. I think that's just decimal, hex, and binary.

P#94949 2021-07-16 14:06 ( Edited 2021-07-19 09:33)

Second this. Although a good convert to and from base 64 may also be handy.

P#94951 2021-07-16 14:20

Hmmm I don't use the

tostr(n,true)

too often but I think this would be cool ya.

P#94963 2021-07-16 21:52 ( Edited 2021-07-16 21:53)

@ElGregos
Hm, probably not, since this only converts a single 16.16 number.

P#95064 2021-07-19 09:34

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 14:07:23 | 0.010s | Q:16