Skip to main content
Known Participant
March 23, 2007
Question

Double quotes in CFScript

  • March 23, 2007
  • 1 reply
  • 1104 views
I need to add " " within a sentence inside my CFscript. When I applied it, I got an error, it seems that CFScript doesn't like the extra "" within "". What should I do so the word "Warning" appear to user within this double quotes

<CFSCRIPT>
.......some codes here

structFormText[numKey][1]["formText"] = "I have some text here and I need to put double quotes surrounding a word within this sentence so that my user will be able to see "Warning" like what you are seeing now ";

................................some codes here
</CFSCRIPT>
This topic has been closed for replies.

1 reply

Inspiring
March 24, 2007
x = ' " Warning " ';
Inspiring
March 24, 2007
Or 2 double quotes escapes a double quote :

message = "This is the ""warning"" message"

You'll get

This is the "warning" message

Regards
BKBK
Community Expert
Community Expert
March 24, 2007
Yet another variation

<cfscript>
x="...my user will be able to see #chr(34)#Warning#chr(34)# like what you are seeing now ...";
</cfscript>
<cfoutput>#x#</cfoutput>