Cicode Programming Reference > Cicode Function Categories > String Functions Introduction > StrToHex

StrToHex

Converts a hexadecimal string into an integer. This function will search the string for the first non-blank character, and then start converting until it finds the end of the string or a non-hexadecimal numeric character. If the first non-blank character is not one of the following hexadecimal characters, the return value is 0 (zero):

Syntax

StrToHex(String)

String:

The string to convert.

Return Value

An integer (converted from String).

Related Functions

StrToReal, StrToValue, HexToStr

Example

Variable=StrToHex("123");
! Sets Variable to hex 123, decimal 291
Variable=StrToHex("F2");
! Sets Variable to hex F2, decimal 242
Variable=StrToHex("G45");
! Sets Variable to 0.
Variable=StrToHex("-FG");
! Sets Variable to hex, -F decimal -15.

See Also

String Functions