CFML question - parsing string

TechBoyJK

Lifer
Oct 17, 2002
16,699
60
91
I have a variable named 'string' that contains a string of text. Within that string is a tag <SPLIT>

The string is basically two different strings joined by the <split> tag.

I need to display the string in the two parts. The part before <SPLIT> and the part after.

I'm curious if I can run, during a cfoutput tag, a function directly on the variable to grab the desired section. This way I could avoid creating two new variables. I'm not quite sure what function to use to parse the string, find <split> and capture what is to the right or left of it.

Method 1

<cfset part1 = function(#string#)>
<cfset part2 = function(#string#)>

<cfoutput>#part1#</cfoutput>
<cfoutput>#part1#</cfoutput>


Method 2

<cfoutput>part1(#string#)</cfoutput>
<cfoutput>part2(#string#)</cfoutput>

What function would be best used to parse the string and grab the section before <split> and after <split>