登录

用户名:

密码:
cfStringFormat(mystring)     
作者:luckzy1228
发部日期:Mon, 04/16/2007

将字符串原意输出 

<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>

<cfset str = "<cfset x = " & "##z## plus hello"">">
<cfoutput>
str = #htmlEditFormat(str)#<br>
cfStringFormat(str) = #htmlEditFormat(cfstringformat(str))#
</cfoutput>

最后更新:Mon, 04/16/2007