// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // // // // // int intArrayFind(int $item, int $index, int[] $list) // // // Return the index of the item if it is in the array and -1 otherwise. // // The array may contain more than one occurrence of the item. // This procedure will return the index of the first occurence of // item starting at index. // // // int $item The int item to search for in the int array. // int $index The array index to begin the search at // int[] $list A list of int values. // // // int : The index of the item if it is in the array and -1 otherwise. // // // int $array1[] = { 1, 2, 3 }; // // ,Result:, 1 2 3 // // int $index = intArrayFind( 1, 0, $array1 ); // // ,Result:, 0 // // int $index = intArrayFind( 2, 0, $array1 ); // // ,Result:, 1 // // int $index = intArrayFind( 3, 4, $array1 ); // // ,Result:, -1 // // int $index = intArrayFind( 0, 0, $array1 ); // // ,Result:, -1 // // // global proc int intArrayFind( int $item, int $index, int $list[] ) { if ( $index >= 0 ) { int $i; for ( $i=$index; $i