IB Statements/hexdec

From CometWiki

< IB Statements
Revision as of 08:42, 22 May 2009 by Badge (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

HEXDEC function 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.

See DECHEX and ASC.

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$)

Personal tools