Retrieving the value which have '#' character in ColdFusion

57 views Asked by At

I'm trying to assign the value of a column from the query to a variable using cfset tag. For example, if the value is 'abcd#1244', then if I use <cfset a = #trim(queryname.column)#> it will return only abcd. But I need the whole value of that column.

1

There are 1 answers

1
TRose On

You will need to escape the # symbol. You can get clever and do it all in one swoop (# acts as an escape character when placed next to another #).

Example being

The item## is #variable#.

In order to print "The item# is 254."

There are plenty of text and string functions at your disposal.

I'd recommend first trying to escape the value as soon as it is drawn from your database.

http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec1a60c-7ffc.html