Friday Puzzle: Actually I need some help :)
UPDATE: So I feel like a complete dumb ass since thanks to Angelos🙂 I swear I was doing what they suggested and it wasn’t working for me. Last time I code and post after a 16 programming marathon.
Does anyone out there know of a way to replace part of a string with a coldfusion variable and evaluate it? Take for instance the following code:
<cfset mystr = “tony”>
<cfset str = “this is a %%test%% to see if this %%works%% or not”>
<cfset str = rereplacenocase(str, “%%([^%%]*)%%”, “##mystr##”, “all”)>
What I’m trying to do is to replace all occurrences of “%%test%%” with “#mystr#” and when I output the str variable, it will replace “#mystr#” with “tony”. Right now when I out then text I get the following:
this is a #mystr# to see if this #mystr# or not
I would like to get it to output like so:
this is a tony to see if this tony or not
Anyone everyone do this?