InputBaseN
Converts a string, using the base specified by radix, to an integer.
Method Signature
InputBaseN(string=[string], radix=[integer])
Arguments
Argument
Type
Required
Description
Default
string
string
true
The string to convert to an integer.
radix
integer
true
Base of the number represented by string, in the range 2-36.
Examples
Binary string to decimal
inputBaseN( "1010", 2 );
Result: 10
Hexadecimal string to decimal
inputBaseN( "3FF", 16 );
Result: 1023
Decimal string to decimal
inputBaseN( "125", 10 );
Result: 125
Binary number to decimal
inputBaseN( 1010, 2 );
Result: 10
Additional Examples
writeDump( InputBaseN( "100100", 2 ) ); // 36 Binary to decimal format
writeDump( InputBaseN( "545", 8 ) ); // 357 Decimal to Octal format
writeDump( InputBaseN( "A", 16 ) );
// 10 Hexadecimal to decimal
Related
Last updated
Was this helpful?