numConv
numConv(t_inputNumber t_format g_needPrefix) =>t_outputNumber/nil
Description
Converts an input number to the specified format.
Arguments
Value Returned
|
Output number converted in the specified format. The output value is returned in the string format. |
|
Examples
The following example converts an input number 100 into hexadecimal format. Note that a prefix 0x is added to the output because the argument g_needPrefix is set to t.
numConv("100" "hex" t)
=> "0x64"
The following example converts an input number 100 into hexadecimal format. Note that no prefix is added to the output because the argument g_needPrefix is set to nil.
numConv("100" "hex" nil)
=> "64"
The following example converts an input number 100 into binary format. Note that a prefix 0b is added to the output because the argument g_needPrefix is set to t.
numConv("100" "bin" t)
=> "0b1100100"
The following example converts an input number 100 into binary format. Note that no prefix is added to the output because the argument g_needPrefix is set to nil.
numConv("100" "bin" nil)
=> "1100100"
Return to top