// =========================================================================== // 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 floatArrayCount(float $item, float[] $list) // // // Return the number of times the float in $item // occurs in the float array $list. // Zero is returned if the float is not in the list. // // // float $item The float item to search for in the float array. // float[] $list A list of float values. // // // int : The number of occurrences of the int item in the int array. // // // float $list[] = { 1.0, 2.5, 3.0, 2.5, 2.5 }; // // Result: 1 2.5 3 2.5 2.5 // // int $count = floatArrayCount( 1.0, $list ); // // Result: 1 // // $count = floatArrayCount( 2.5, $list ); // // Result: 3 // // $count = floatArrayCount( 4.0, $list ); // // Result: 0 // // // // global proc int floatArrayCount(float $item, float $list[]) { int $result = 0; float $listItem; for ($listItem in $list) { if ($item == $listItem) $result++; } return $result; }