stringToHex(str)
Last updated May 08, 2006
Version: 1 | Requires: CF5 | Library: StrLib
Description:
Counterpart to HexToString - converts an ASCII string to hexadecimal.
Return Values:
Returns a string.
Example:
<cfoutput>#stringToHex("hello")#</cfoutput>
Parameters:
Name | Description | Required |
---|---|---|
str | String to convert to hex. | Yes |
Full UDF Source:
/**
* Counterpart to HexToString - converts an ASCII string to hexadecimal.
*
* @param str String to convert to hex. (Required)
* @return Returns a string.
* @author Chris Dary (umbrae@gmail.com)
* @version 1, May 8, 2006
*/
function stringToHex(str) {
var hex = "";
var i = 0;
for(i=1;i lte len(str);i=i+1) {
hex = hex & right("0" & formatBaseN(asc(mid(str,i,1)),16),2);
}
return hex;
}
Search CFLib.org
Latest Additions
Raymond Camden added
QueryDeleteRows
November 04, 2017
Leigh added
nullPad
May 11, 2016
Raymond Camden added
stripHTML
May 10, 2016
Kevin Cotton added
date2ExcelDate
May 05, 2016
Raymond Camden added
CapFirst
April 25, 2016