macromedia.coldfusion.cfml_general_discussion
[Top] [All Lists]

Re: ListFind and ListContains

Subject: Re: ListFind and ListContains
From: Ian Skinner
Date: Wed, 17 Sep 2008 07:56:11 -0700
Newsgroups: macromedia.coldfusion.cfml_general_discussion


Olivia Crazy Horse wrote:
ok, sorry for being so dense. but this is completely new to me, thus I post here for help, I am not trying to be funny or anything, just not very brigth in all this cf stuff, like you guys.

So let me see if I understand this now : ListFind will search for the desired value within a string, and if found, returns the starting position of that value, thus #ListFind(string_values,"Other (No Reason)")# will return 2, if it is the second value in the list, so that is why the other example say > 0 . Is that the correct interpretation ?


Not the 'starting position' that would be what the basic string 'find()' function would return. listFind() will return the 'element position' of the matched element in the list as defined by the delimiting character.

If you are having trouble with this, it might be clearer if you just output some examples and see how they all behave.

<cfset aListString = "red,blue-green,yellow,green,pink">

<cfoutput>
  find(): #find('green',aListString)#<br/>
  listFind(): #listFind(aListString,'green')#<br/>
  listConatins: #listFind(aListString,'green')#<br/>
</cfoutput>

<Prev in Thread] Current Thread [Next in Thread>