$base » History » Version 6
Per Amundsen, 11/07/2018 01:10 PM
1 | 1 | Per Amundsen | _Added in 1.9.0_ |
---|---|---|---|
2 | |||
3 | *$base(N,inbase,outbase,zeropad,precision)* |
||
4 | |||
5 | Converts number N from inbase to outbase. The last two parameters are optional. |
||
6 | |||
7 | 6 | Per Amundsen | _In version 3.3+, it should work reliably to at least base64, otherwise to base32._ |
8 | |||
9 | 1 | Per Amundsen | *Parameters* |
10 | |||
11 | N - The number to convert. |
||
12 | inbase - The base to convert from. |
||
13 | outbase - The base to convert to. |
||
14 | 4 | Per Amundsen | zeropad - If length is higher than zeropad, pad numbers with zeroes to this zeropad length. |
15 | 1 | Per Amundsen | precision - TODO |
16 | |||
17 | *Example* |
||
18 | |||
19 | <pre> |
||
20 | 5 | Per Amundsen | ; Returns F |
21 | 1 | Per Amundsen | //echo -ag $base(15,10,16) |
22 | |||
23 | 5 | Per Amundsen | ; Returns 1.8 |
24 | 1 | Per Amundsen | //echo -ag base(1.5,10,16) |
25 | |||
26 | 5 | Per Amundsen | ; Returns 002 |
27 | 1 | Per Amundsen | //echo -ag $base(2,10,16,3) |
28 | </pre> |