Project

General

Profile

$base » History » Revision 7

Revision 6 (Per Amundsen, 11/07/2018 01:10 PM) → Revision 7/10 (Per Amundsen, 11/07/2018 01:11 PM)

_Added in 1.9.0_ 

 *$base(N,inbase,outbase,zeropad,precision)* 

 Converts number N from inbase to outbase. The last two parameters are optional. 

 _In version 3.3+, it should work reliably to at least base64, otherwise to base32._ 

 *Parameters* 

 N - The number to convert. 
 inbase - The base to convert from. 
 outbase - The base to convert to. 
 zeropad - If length is higher than zeropad, pad numbers with zeroes to the specified this zeropad length. 
 precision - Truncate fractions/decimal places to the specified precision. TODO 

 *Example* 

 <pre> 
 ; Returns F 
 //echo -ag $base(15,10,16) 

 ; Returns 1.8 
 //echo -ag base(1.5,10,16) 

 ; Returns 002 
 //echo -ag $base(2,10,16,3) 
 </pre>