Introduction | Language Structure | IB Statements | File System | Comet 32 Runtime | Index |
| Syntax: | HEXDEC(string-argument) |
| Discussion: |
The HEXDEC function converts a two-byte binary string to its
decimal equivalent.
The string-argument represents the two-byte binary string to be converted. The string-argument may be a string constant, a single-element string variable, a string array element, a string expression, or a string function. The maximum possible value returned by the HEXDEC function is 65,535, the decimal equivalent of "@FFFF@" hex. |
| Example 1: |
VALUE = HEXDEC(STR$)In the above example, the two-byte value contained in variable STR$ is converted to its decimal equivalent. The result is stored in numeric variable VALUE. For example, if STR$ equals "@3039@" hex, then VALUE will equal 12,345 (the decimal equivalent of hex "3039"). Or, if STR$ equals "@FFFF@" hex, then VALUE will equal 65,535 (the decimal equivalent of hex "FFFF"). |
| Example 2: |
VALUE = HEXDEC(SUB(STR$,1,1))In this example, the first byte of the variable STR$ is converted to its decimal equivalent. This statement produces the same result as: VALUE = ASC(STR$) |