StrToNumHex

InstallShield 2020 » InstallScript Language Reference

The StrToNumHex function converts a string to a number. It inspects szString, starting with the character at position 0 and continuing through the string until it reaches the end of the string or encounters a character that is not in the range "0"..."9", "a"..."f", "A"..."F". (The first two characters in the string may be "0x" or "0X".) Then one of the following processes occurs:

If all of the characters in the string are in the range "0".."9", the hexadecimal number represented by the string is assigned to nvVar.
If the string begins with one or more characters in the hexadecimal range but also contains one or more non-hexadecimal characters, a number based on the characters to the left of the first non-hexadecimal character is assigned to nvVar. For example, if szString is "0x1A2GHI456", nvResult will be 418 (0x1A2).
If the first character in the string is not in the hexadecimal range, the function fails.
If the first two characters in the string are "0x" or "0X" and the third character is not in the hexadecimal range, the function fails.

Syntax

StrToNumHex ( nvVar, szString );

Parameters

StrToNumHex Parameters

Parameter

Description

nvVar

Returns the number created from the string in szString.

szString

Specifies the string to convert to a number.

Return Values

StrToNumHex Return Values

Return Value

Description

>= ISERR_SUCCESS

Indicates that the function successfully converted the string into a numeric value.

< ISERR_SUCCESS

Indicates that the function was unable to convert the string into a numeric value.

See Also