Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

escaping double quotes in a cfparam

Status
Not open for further replies.

TechDude

Programmer
Jul 20, 2000
62
US
Hi all,
I am creating a comma delimited file to be imported into excel.

I need the text of the fields to be double quoted.

the following code creates the file by concatenating the values of the form fields submitted by a form

<cfparam default=&quot;&quot; name=&quot;temp_output&quot; type=&quot;string&quot;>
<cfloop index=&quot;fname&quot; list=&quot;#form.fieldnames#&quot; >
<cfset temp_output = temp_output & #evaluate(&quot;form.&quot; & fname)#&&quot;,&quot;>
</cfloop>
<cfoutput>#removechars(temp_output,len(temp_output),1)#</cfoutput>

<cffile file=&quot;D:\utilities\testing.xls&quot; action=&quot;append&quot; output=&quot;#removechars(temp_output,len(temp_output),1)#&quot; >

the following snippet from the previous code is where I have the issue

<cfset temp_output = temp_output & #evaluate(&quot;form.&quot; & fname)#&&quot;,&quot;>

I need the output of #evaluate(&quot;form.&quot; & fname)# to be double quoted

is there a way to escape double quotes?
if so I could do something like this
<cfset temp_output = temp_output & &quot;(escapechar)&quot;&quot;&&quot;#evaluate(&quot;form.&quot; & fname)#&&quot;(escapechar)&quot;&quot;&&quot;,&quot;>


any help would be most appreciated

Chris Sorel
chris@exnihilo.com
Remember, If you continue to do what you have always done,

you will continue to get what you have always gotten.
 
I thought you could use Chr(34)?? So you can do something like:

<cfset temp_output = temp_output & #Chr(34)# & #evaluate(&quot;form.&quot; & fname)# & #Chr(34)# & &quot;,&quot;>

NOTE: Not tested

Simon
 
not tested either, but how about trying \&quot; ?
 
Thanks,
The chr(34) worked.

Chris Sorel
chris@exnihilo.com
Remember, If you continue to do what you have always done,

you will continue to get what you have always gotten.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top