> Quotes and the proper use of, come up quite frequently on this list. I
> thought I would pass on today's CF tip from TipWorld (highly
> recommended
> BTW)...
>
> QUOTES AND DE()
>
> As you've probably discovered yourself, quotes can be a pain during
> processing. ColdFusion helps out by providing a function that lets you
> Delay Evaluation: DE(). Basically, what it does is wrap the string in
> double quotes with any quotes in the string escaped.
>
> Suppose you want to display to the user a string wrapped in quotation
> marks. You can quickly and easily do so by including in your code
> something similar to the following:
>
>    <CFOUTPUT>
>    You entered #DE(form.input1)# into the field.
>    </CFOUTPUT>
>
> In this case, say the user typed the string (including the single
> quotes)
>
>    Three 'blind' mice
>
> ColdFusion would display
>
>    "Three 'blind' mice"
>
> Notice that this function works with both single and double quotation
> marks.

I could do that, but why wouldn't I just do this:

<CFOUTPUT>
You entered "#Form.input1#" into the field.
</CFOUTPUT>

Maybe I'm missing something, but I don't see an advantage to using DE for
that. I only generally use DE within IIF to prevent the automatic evaluation
of one of the strings.

Now, since I don't just want to be critical, here's something I picked up
today. CF 4.5.1 has a new function, Duplicate, which will perform a "deep
copy". That is, it will copy all of the stuff within a single variable by
value, instead of by reference. So, for example, I could have an array,
which contains a query in each member, and I could copy the whole thing by
value using one line of code:

<CFSET myarraycopy = Duplicate(myarraywithqueries)>

I thought that was pretty neat, and it allows you an alternative for
handling memory variable locking, which has been discussed a bit here
lately. Instead of using CFLOCK around every instance of a variable, you
could duplicate your entire session into a local variable inside of a single
CFLOCK. It's described in the 4.5.1 release notes.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to