Wow! This works great!

What if there are multiple things to replace within the variable? For example, 
you have a string like: 


"Hi DECISIONMAKER. This is MYNAME."

I want to replace DECISIONMAKER with "Bob" and I want to replace MYNAME with 
"Scott."

 Scott Williams



----- Original Message ----
From: Brian Cain <bcc9...@gmail.com>
To: cf-talk <cf-talk@houseoffusion.com>
Sent: Fri, April 1, 2011 8:25:31 AM
Subject: Re: Including a variable within a database response


Easiest way is to use the Replace function built in to CF.

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=functions_m-r_32.html


<http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=functions_m-r_32.html>If

you have multiple instances of the replacement value be sure to specify the
"All" scope.  You may also want to look at the ReplaceNoCase function.

Brian Cain

On Fri, Apr 1, 2011 at 10:22 AM, Scott Williams
<myscottwilli...@yahoo.com>wrote:

>
> Hi all --
>
> I have a script that draws some text from a database, and I would like to
> embed
> a person's name within the text.
>
> For example, the database field contains this text:
>
> Hi #name#. How's it going?
>
> I would like the #name# to be replaced with a previously defined variable
> "name."
>
> Can ColdFusion do this? If so, how?
>
> Scott
>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343488
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to