And Claude, besides confirming Cassie’s observation that you needed to use & 
and not +, I had wondered if Dale’s first answer might have done the trick even 
more simply. You never seemed to reply to that:

<cfset mycommand = “##reboot##” & url.id & “##1212##” />

That covers the escaping of the hashes, and the concatenation of the variable 
(which as many have noted, requires & in CFML, not +).

And indeed, I just ran the code that way:

<cfparam name="url.id" default="45454">

<cfset mycommand = "##reboot##" & url.id & "##1212##" />

(the cfparam simply allows the page to be run even if no querystring is passed 
initially), and it output:

#reboot#45454#1212#

And to prove that it worked as a true URL variable, I ran it as this:

http://localhost/test.cfm?id=45455

and it output:

#reboot#45455#1212#

That seems what you want, right? (Of course, you say you want that in the 
variable, and this gives you that.  What you may do with the value next, and 
how that may go, is another question.)

And FWIW, Dale’s second answer also would have worked, though it rather than 2 
chr’s only one is needed, to produce that same output as above:

<cfparam name="url.id" default="45454">

<cfset delim = chr(35) />

<cfset mycommand= delim & "reboot" &  delim & url.id & delim & "1212" & delim />

 

<cfoutput>#mycommand#</cfoutput>

Hope that’s helpful.

/charlie

 

From: cfaussie@googlegroups.com [mailto:cfaussie@googlegroups.com] On Behalf Of 
Cassie Woolley
Sent: Sunday, March 01, 2015 7:51 PM
To: cfaussie@googlegroups.com
Subject: RE: SPAM-LOW: RE: [cfaussie] Creating A String With ## values in 
coldfusion

 

I think it should be & and not +.

 

-- 
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cfaussie+unsubscr...@googlegroups.com.
To post to this group, send email to cfaussie@googlegroups.com.
Visit this group at http://groups.google.com/group/cfaussie.
For more options, visit https://groups.google.com/d/optout.

Reply via email to