views:

80

answers:

1

Hello,

I'm trying to replace two special characters using the replace function in ColdFusion:

<cfset MyQuery = "/Attribute One\/Attribute Two\/Attribute Three\">
<cfset MyString = Replace(MyQuery, "/", "<li>", "ALL")>
<ul>
<cfoutput>#MyString#</cfoutput>
</ul>

This works well, but I need to correctly close my li tags. I tried adding the following which did not work:

<cfset MyString = Replace(MyQuery, "/", "<li>", "ALL") AND Replace(MyQuery, "\", "</li>", "ALL")>

First question: Is this the right way to what I'm attempting? Or should I just store my html inside the database along with the attributes?

Second question: If my approach is correct, could someone please provide an example of the correct syntax?

Many thanks!

+3  A: 
Sergii
That's brilliant, thank you. Is there a way to include the ul tags in this?
Mel
Sergii