You need to append commas before and after mynumber, that way you are
looking for ",2," not just "2". You might be able to do this within the
cfif like this:
<cfif #listcontains(mylist, ","&mynumber&",")# is 0>
but you will probably have to create another variable: <cfset
mynumfind=","&mynumber&",">
and then use mynumfind in place of mynumber in the <cfif> statement.
Also you will have to deal with the first and last numbers of the list since
they are not surrounded by commas. The simplest way (if it won't screw up
the list) would be to have the list start and end with a comma.
There may be a more elegant way to do this using sql.
-----Original Message-----
From: Gilles Ratte [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 07, 2000 10:52 AM
To: 'cftalk'
Subject: contained in a list
I need know if a number is one of a list item.
let me explain
let's say.. mynumber = 2 ans mylist = 2,67,34,52
I thought this would do ..
<cfif #listcontains(mylist, mynumber)# is 0>
..
<cfelse>
..
</cfif>
but it does not act like I want ... It compare the same whay as of strings
and will find 2 and 52
What I want to do is to get the exact item in the list
Someone has an idea on how to do it?
Thanks
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.