xHarbour Reference Documentation > Function Reference |
Converts a Hex string to a numeric value.
HexToNum( <cHexString> ) --> nNumber
The function returns the decoded Hex string as a numeric value.
HexToNum() converts a Hex formatted character string to a numeric value. It converts only characters in the range from "0-9" and "a-f" or "A-F". If <cHexString> contains any other character, the conversion is stopped. The reverse function is NumToHex().
See also: | CStr(), HexToStr(), NumToHex(), StrToHex(), StrZero(), Transform() |
Category: | Numeric functions , Conversion functions , xHarbour extensions |
Source: | rtl\hbhex2n.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example demonstrates return values of HexToNum() PROCEDURE Main ? HexToNum( "1" ) // result: 1 ? HexToNum( "FF" ) // result: 255 ? HexToNum( "FFFF" ) // result: 65535 ? HexToNum( "FFFFFFFFFFFFFFFF" ) // result: -1 ? HexToNum( "ffffffffffffff80" ) // result: -128 RETURN
http://www.xHarbour.com