[thelist] CF Question: Permutation of right(string, count)

Seth Bienek seth at sethbienek.com
Mon Jan 8 17:30:26 CST 2001

Hi ML, you need to use a few CF string manipulation functions to do this...
Here's a working example I threw together.. I hope it helps, if you have any
questions just shoot them back through the list..

<!--- Create a string with our sample text. --->
<cfset content = "foo,bar">

<!--- Get the position of the first comma in the string. --->
<cfset commapos = find(",", content)>

<!--- Advance the cursor to the position AFTER the first comma.
	This is where the content you want to parse out starts. --->
<cfset startpos = commapos + 1>

<!--- I'm assuming that you want EVERYTHING after the comma. If
	so, then you want the cursor position of the last character
	in  the string.  Use CF's len() function for this. --->
<cfset endpos = len(content)>

<!--- We need to know how many characters are in the string we
	want to parse out.  Simple math here. --->
<cfset stringlength = endpos - commapos>

<!--- We use CF's Mid() function to grab the good stuff out of
	the original string. --->
<cfset newcontent = mid(content, startpos, stringlength)>

<!--- Output the results of our task. --->

Take Care,


Seth Bienek
Solutions Development Manager
Stonebridge Technologies, Inc.
972.455.7294 tel
972.404.9754 fax

> -----Original Message-----
> From: thelist-admin at lists.evolt.org
> [mailto:thelist-admin at lists.evolt.org]On Behalf Of Minh Lee Goon
> Sent: Monday, January 08, 2001 3:23 PM
> To: evolt
> Subject: [thelist] CF Question: Permutation of right(string, count)
> Dear evolta,
> I would like to retrieve only the characters to the right of a comma. I
> tried using the right(string, count) expression but the number of
> characters after the comma isn't always constant so I'm bound to get
> errors. For example, if my string is "foo,bar" I'd like to retrieve
> "bar" only.
> I was wondering if there's a quick and easy way of retrieving the
> characters to the right of a comma, instead of n number of characters
> from the right.
> </ml>
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !

More information about the thelist mailing list