xHarbour Reference Documentation > Function Reference |
Converts a character string to a Hex string.
StrToHex( <cString>, [<cSeparator>] ) --> cHexString
The function returns a character string holding the passed value in hexadecimal notation.
StrToHex() converts a character string to a Hex formatted character string by converting the ASCII codes of each charater in <cString> and collecting them in the return string. The reverse function is HexToStr() which accepts a Hex encoded character string.
Note: <cSeparator> is provided for formatting purposes of the returned string and to enhance readability. If it is used, the returned string cannot be decoded with HexToStr().
See also: | CStr(), HexToNum(), HexToStr(), NumToHex(), Transform() |
Category: | Character functions , Conversion functions , xHarbour extensions |
Source: | rtl\hbhex2n.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example demonstrates return values of StrToHex() without // and with separating character PROCEDURE Main LOCAL cString := "xHarbour" ? StrToHex( cString ) // result: 78486172626F7572 ? StrToHex( cString, "|" ) // result: 78|48|61|72|62|6F|75|72 RETURN
http://www.xHarbour.com