// =========================================================================== // 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. // =========================================================================== // // // Creation Date: 04 January 1999 // // Remove all duplicate string items from a string array. There will be // only one occurrence of each string item in the returned string array. // The argument string array is not modified. // // Examples: // // string $list[] = { d, b, c, c, a, a, b }; // string $shorterList[] = AWRemoveDuplicateStringsFromStringArray($list); // // Result : { d, b, c, a } // // // Note: Use stringArrayRemoveDuplicates instead of this script. // global proc string [] AWRemoveDuplicateStringsFromStringArray(string $list[]) { string $item, $result[]; int $index = 0; for ($item in $list) { if (0 == AWNumberOfOccurrencesInStringArray($item, $result)) { $result[$index++] = $item; } } return $result; }