Finding Values In A ColdFusion Array Using Java - And Other Cool Stuff

<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.">
	 
	<!--- Define arguments. --->
	<cfargument name="Array" type="array" required="true" />
	<cfargument name="Value" type="string" required="true" />
	 
	<cfscript>
		 
		// Define the local scope.
		var LOCAL = StructNew();
		 
		// Loop over array to find value.
		for (
			LOCAL.Index = 1 ; 
			LOCAL.Index LTE ArrayLen( ARGUMENTS.Array ) ; 
			LOCAL.Index = (LOCAL.Index + 1)
			){
			 
			// Check to see if this is the value.
			if (NOT Compare( 
				ARGUMENTS.Array[ LOCAL.Index ], 
				ARGUMENTS.Value 
				)){
				 
				// This value matches, return index.
				return( LOCAL.Index );
			}
		 
		}
		 
		// We did not find a match. Return zero.
		return( 0 );
	 
	</cfscript> 
</cffunction>

For Cut-and-Paste