<cffunction
name="ArrayFind"
access="public"
returntype="numeric"
output="false"
hint="Finds a value in an array and returns the index. Returns zero on no find.">
<cfargument name="Array" type="array" required="true" />
<cfargument name="Value" type="string" required="true" />
<cfscript>
var LOCAL = StructNew();
for (
LOCAL.Index = 1 ;
LOCAL.Index LTE ArrayLen( ARGUMENTS.Array ) ;
LOCAL.Index = (LOCAL.Index + 1)
){
if (NOT Compare(
ARGUMENTS.Array[ LOCAL.Index ],
ARGUMENTS.Value
)){
return( LOCAL.Index );
}
}
return( 0 );
</cfscript>
</cffunction>