cfStringFormat(mystring)
Last updated May 9, 2003
Version: 1 | Requires: ColdFusion 5 | Library: StrLib
Description:
escapse all double-quotes and pound symbols in a string and replaces all ascii non-printing characters with a #chr(x)# equivalent
Return Values:
Returns a string.
Example:
<cfoutput>
str = #htmlEditFormat(str)#<br>
cfStringFormat(str) = #htmlEditFormat(cfstringformat(str))#
</cfoutput>
Parameters:
| Name | Description | Required |
|---|---|---|
| mystring | String to format. | Yes |
Full UDF Source:
<cfscript>
/**
* companion to jsstringformat - formats a string for use as a coldfusion literal value
*
* @param mystring String to format. (Required)
* @return Returns a string.
* @author Isaac Dealey (info@turnkey.to)
* @version 1, May 9, 2003
*/
function cfStringFormat(mystring) {
var x = 0;
var npc = "";
var npcc = "";
mystring = rereplacenocase(mystring,"(""|##)","\1\1","ALL");
for (x = 1; x lte 31; x = x + 1) {
npc = listappend(npc,chr(x));
npcc = listappend(npcc,"##chr(#x#)##");
}
return replacelist(mystring,npc,npcc);
}
</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)