将字符串原意输出 <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> |