PDA

View Full Version : StrToHex



dboechler
08-09-2005, 03:19 PM
Is there a StrToHex function somewhere in Installshield or maybe a script someone has written? I can't seem to locate the syntax

umasankar
08-10-2005, 06:33 AM
This is a function in vb....it may help you.


Function StringToHex(str as String) as String
dim x as long, hexchar as string
for x = 1 to len(str)
hexchar = hex$(asc(mid$(str, x, 1)))
if len(hexchar) = 1 then hexchar = "0" & hexchar
StringToHex = StringToHex & hexchar
next x
End Function


Uma Sankar

walleye
08-10-2005, 04:38 PM
Version 11 has function called StrToNumHex check the help pages.

Here is a function I wrote that prints a string out in hex.

function PrintHex ( szText )

NUMBER i;

STRING szOutString;
STRING szHexString;

begin

//convert each character of the string to ASCII hex value
for i = 0 to StrLength ( szText )

Sprintf ( szHexString, "%x ", szText[i] );
szOutString = szOutString + szHexString;

endfor;

MessageBox( szText + "\n in hex \n" +
szOutString,
INFORMATION );

end;