<cfset findthis = "UK,Australia,South Africa">
<cfset inthis = "UK Hello and welcome to <b> the list</b>.australia
south africa This is it!">
<Cfloop list="#findthis#" delimiters="," index="i">
<cfset customSearch = Refindnocase("#i#",inthis, 1)>
<Cfif CustomSearch GT 0>
<Cfoutput>
Found #i#
</CFOUTPUT>
<!--- when the first item is found break out of the loop --->
<cfbreak>
</cfif>
</cfloop>
Also, you do not need to use ReFindNoCase since you are not using a regular
expression, you can simply use FindNoCase the syntax is basically the same.
HTH
Donnie Bachan
Phone: (718) 217-2883
ICQ#: 28006783
"Nitendo Vinces - By Striving You Shall Conquer"
======================================================================
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from any
computer.
----Original Message Follows----
From: "W Luke" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: CF-Talk <[EMAIL PROTECTED]>
Subject: More Refindnocase woes
Date: Mon, 2 Jun 2003 20:51:47 +0100
Right, I'm having a dead-brain moment here. The code below may not be
the best, but it does its job well enough apart from the problem I'm
having, of course :)
<cfset findthis = "UK,Australia,South Africa">
<cfset inthis = "UK Hello and welcome to <b> the list</b>.australia
south africa This is it!">
<Cfloop list="#findthis#" delimiters="," index="i">
<cfset customSearch = Refindnocase("#i#",
inthis, 1)>
<Cfif CustomSearch GT 0>
<Cfoutput>
Found #i#
</CFOUTPUT>
</cfif>
</cfloop>
I need to keep the cfloop as it is really, so any changes would best be
done in the refindnocase itself if that's possible. The problem is that
in this example, #i# would find all 3. I only ever want it to return
the first *found* country. I'm already limiting the text-to-be-searched
by 30 characters, but on occasions, more than 1 country is being found
and it's just making things screw up. What I want to tell it, is: "Find
one of these countries, but make sure if you find more than one that you
only choose the one the farthest to the left!"
Can anyone decipher my question/problem, let alone suggest a solution?
Cheers
Will
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.
http://www.cfhosting.com
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4