Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

listcontains problem

Participant ,
May 09, 2008 May 09, 2008
Hi,

I have a list (6,7,8,9,10,11) when I try and use listcontains to find the number 1, it picks out 11 when I want it to find the actual number 1.

Can anyone please help?

Thankyou
595
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 09, 2008 May 09, 2008
check out the listFind() function
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 09, 2008 May 09, 2008
Mattastic wrote:
> Hi,
>
> I have a list (6,7,8,9,10,11) when I try and use listcontains to find the number 1, it picks out 11 when I want it to find the actual number 1.
>
> Can anyone please help?
>
> Thankyou


listContains() searches a list for a string fragment which may be part
of an item.

listFind() searches a list for an entire item.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 09, 2008 May 09, 2008
In a situation like this, the first thing to do is check the documentation. Determine if you are using the function correctly and if the function actually does what you need it to do. If it is not the right function to use, see what other List functions are available.
http://livedocs.adobe.com/coldfusion/7/htmldocs/00000364.htm#1099435

In the documentation it says ListContains "Determines the index of the first list element that contains a specified substring". So it would match "11", "112", "192637", etcetera. Clearly this is not the correct function for your needs. To find a whole element, use something like ListFind or ListFindNoCase.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 09, 2008 May 09, 2008
I agree, but the livedocs can be slows a moleasses which is frustrating, and doesn't have a proper search. I recommend downloading the PDFs and just putting shortcuts in your toolbar (at least to the reference file) or some other useful place where they can be pulled up at any time.

http://www.adobe.com/support/documentation/en/coldfusion/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 09, 2008 May 09, 2008
quote:

Originally posted by: danielmroberts
I agree, but the livedocs can be slows a moleasses which is frustrating, and doesn't have a proper search. I recommend downloading the PDFs and just putting shortcuts in your toolbar (at least to the reference file) or some other useful place where they can be pulled up at any time.

http://www.adobe.com/support/documentation/en/coldfusion/

I use google.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 09, 2008 May 09, 2008
LATEST
Yes. I agree. It can be slow at times. In addition to the options mentioned, another one is http://cfquickdocs.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources