IConv MX, HEX, MO, MB function
Description
Converts hexadecimal, octal, or binary formatted data into internal system format (decimal numbers). The value to convert can be as great as that represented with 32 bits.
Syntax
internal = IConv(string, "MX")
internal = IConv(string, "HEX")
internal = IConv(string, "MO")
internal = IConv(string, "MB")
Parameters
IConv (MX, etc.) accepts arguments for the following parameters.
Parameter | Description | |
---|---|---|
string | The character range for each character in string is 0 - 9, A - F. Using characters outside the respective ranges will result in a conversion error. | |
MX | The parameter string must be a hexadecimal character set (base 16), it is converted to the equivalent decimal number (base 10). | |
HEX | The parameter string must be a string of hexadecimal character sets, it is converted to a string of ASCII values. | |
MO | The parameter string must be an octal (base 8), number, it is converted to a decimal number. | |
MB | The parameter string must be an ASCII representation of a binary (base 2) number; it is converted to a decimal number. If string yields an incorrect value, a 0 (zero) will be returned. |
Remarks
An understanding of different number bases is required for the effective use of these specifications. Use the following table as a guide to conversions to different number bases.
Conversion Code | Iconv | Oconv |
---|---|---|
MX | hexadecimal to decimal | decimal to hexadecimal |
MO | octal to decimal | decimal to octal |
MB | binary to decimal | decimal to binary |
Example
*Converting various number systems. A = IConv("2A","MX") * Output is 42 A = IConv('595A','HEX') * Output is YZ A = IConv("1000","MB") * Output is 8