// Copyright (C) 1997-2014 Autodesk, Inc., and/or its licensors.
// All rights reserved.
//
// The coded instructions, statements, computer programs, and/or related
// material (collectively the "Data") in these files contain unpublished
// information proprietary to Autodesk, Inc. ("Autodesk") and/or its licensors,
// which is protected by U.S. and Canadian federal copyright law and by
// international treaties.
//
// The Data is provided for use exclusively by You. You have the right to use,
// modify, and incorporate this Data into other products for purposes authorized 
// by the Autodesk software license agreement, without fee.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. AUTODESK
// DOES NOT MAKE AND HEREBY DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTIES
// INCLUDING, BUT NOT LIMITED TO, THE WARRANTIES OF NON-INFRINGEMENT,
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, OR ARISING FROM A COURSE 
// OF DEALING, USAGE, OR TRADE PRACTICE. IN NO EVENT WILL AUTODESK AND/OR ITS
// LICENSORS BE LIABLE FOR ANY LOST REVENUES, DATA, OR PROFITS, OR SPECIAL,
// DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES, EVEN IF AUTODESK AND/OR ITS
// LICENSORS HAS BEEN ADVISED OF THE POSSIBILITY OR PROBABILITY OF SUCH DAMAGES.

//
//<doc>
//<name stringArrayFind>
//
//<synopsis>
//		int stringArrayFind(string $item, int $index, string[] $array)
//
//<description>
//		Returns the index of the first occurrence of <em>$item</em> in
//		<em>$array</em>, starting at element <em>$index</em>.
//		If <em>$item</em> is not found then -1 is returned.
//
//<flags>
//		string   $item   The string item to search for in the string array.
//		int      $index  The array index to begin the search at
//		string[] $array  An array of string values.
//
//<returns>
//		int : The index of the item if it is found or -1 if it is not found.
//
//<examples>
//	string $array[] = { "item1", "item2", "item3" };
//	// Result: item1 item2 item3 //
//	int $index = stringArrayFind( "item1", 0, $array );
//	// Result: 0 // 
//	$index = stringArrayFind( "item2", 0, $array );
//	// Result: 1 // 
//	$index = stringArrayFind( "item3", 4, $array );
//	// Result: -1 // 
//	$index = stringArrayFind( "blah", 0, $array );
//	// Result: -1 // 
//</doc>
//

global proc int stringArrayFind( string $item, int $index, string $array[] )
{
	if ( $index >= 0 )
	{
		int $i;
		for ( $i=$index; $i<size($array); $i++ )
			if ( $array[$i] == $item )
				return $i;
	}
	return -1;
}
