House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home / Groups / ColdFusion Talk (CF-Talk)

Checking for a duplicate value question

Author:
Leigh
05/04/2012 06:10 AM

> Not sure how you tested this Define a variable representing a number as a double:           <cfset y = val("15")>           <cfset arr = [y]> Now run indexOf("15"). The value is not found because unlike CF functions, java lists also consider data type when determining element equality.         15 = #arr.indexOf("15")#  ==> -1 / not found          y = #arr.indexOf(y)#  ==> 0 / found > It returns the index of the value, secondly if you wish to do a case > insenstive index then it is still possible. Well my point was not that it is _not_ possible ;-) It was that indexOf is not a straight equivalent of CF9's array functions. So before using it,  be aware of these two differences. >  public boolean function containsIgnoreCase(required array arrayList, > var it = arrayList.iterator(); > while(it.hasNext()) { Honestly, I do not see the benefit of down to the java level for this. If you are going to end up looping anyway, may as well use a native cfloop array="...". It is


Search cf-talk

May 21, 2013

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference