Not sure how you tested this, but if you have

<cfset myArray = ["1","2","3","4"] />

<cfoutput>

#myArray.indexOf(1)+1#

</cfoutput>

It returns the index of the value, secondly if you wish to do a case
insenstive index then it is still possible.

Lets take the following code for example that returns true or false if it
contains the string

<cfset myArray = ["myTest","2","3","4"] />

<cfoutput>
#myArray.indexOf(lcase('mytest'))+1#
 #containsIgnoreCase(myArray, 'myTest1')#
</cfoutput>

<cfscript>
public boolean function containsIgnoreCase(required array arrayList,
required string s) {
 var it = arrayList.iterator();
while(it.hasNext()) {
if(it.next().equalsIgnoreCase(s))
 return true;
}
return false;
 }
</cfscript>

So as you can see it is extremely possible, But what would be better is if
ColdFusion used Java as part of its language and was OOP, that would mean
you could write a component that extended the ArrayList / Array and
override the equals to do the case insensitive compare.


-- 
Regards,
Andrew Scott
WebSite: http://www.andyscott.id.au/
Google+: http://plus.google.com/108193156965451149543




On Fri, May 4, 2012 at 7:12 PM, Leigh <cfsearch...@yahoo.com> wrote:

>
> >  ArrayFind() is case senstive, that is why there is an ArrayFindNoCase().
>
> Yes but the indexOf(..) method is _always_ case sensitive. Also, unlike
> arrayFind/FindNoCase it is data type sensitive as well. ie indexOf(15) does
> not produce the same results as indexOf("15"). So it is good to be aware of
> the nuances.
>
> -Lei
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350995
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to