// =========================================================================== // 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 stringArrayFind(string $item, int $index, string[] $array) // // // Returns the index of the first occurrence of $item in // $array, starting at element $index. // If $item is not found then -1 is returned. // // // 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. // // // int : The index of the item if it is found or -1 if it is not found. // // // 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 // // // global proc int stringArrayFind( string $item, int $index, string $array[] ) { if ( $index >= 0 ) { int $i; for ( $i=$index; $i