|
Mailing Lists
|
Home / Groups / ColdFusion Talk (CF-Talk)
Checking for a duplicate value question> 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 |
May 21, 2013
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||