stringToHex(str)
Last updated May 8, 2006
Version: 1 | Requires: ColdFusion 5 | Library: StrLib
Description:
Counterpart to HexToString - converts an ASCII string to hexadecimal.
Return Values:
Returns a string.
Example:
Parameters:
| Name | Description | Required |
|---|---|---|
| str | String to convert to hex. | Yes |
Full UDF Source:
<cfscript>
/**
* 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;
}
</cfscript>
Search CFLib.org
Latest Additions
Shawn Porter added
DeMoronize
3 hour(s) ago
Chris Carey added
readPropertiesFi...
1 day(s) ago
Randy Johnson added
lastDayofWeek
3 day(s) ago
Frank Marion added
sitemapPing
7 day(s) ago
Top Rated
QuickSort
Rated 5.0, 3 time(s)
indentXml
Rated 5.0, 3 time(s)
queryColumnsToSt...
Rated 5.0, 3 time(s)
generateSsccAsn
Rated 5.0, 3 time(s)