// =========================================================================== // 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: Jul 2, 1998 // // // // // int tokenizeList( string $list, string $tokenizedList[] ) // // // Takes a string $list representing a list of items. The // items can be either whitespace- or comma-separated. // The individual items in the list are returned as elements // of the result array, stored in $tokenizedList. // // // string $list The string of values to tokenize. Separated by // either whitespace or commas. // string[] $tokenizedList The items in $list, after tokenization // // // string $list = "1 6 7, 54"; // string $tokenizedList[]; // tokenizeList($list, $tokenizedList); // // Result : 1 // // print $tokenizedList; // // 1 // // 6 // // 7 // // 54 // // int : 1 if successful, 0 if unsuccessful // // // global proc int tokenizeList( string $list, string $tokenizedList[] ) { string $regExpr = ","; string $replaceWith = " "; string $substitutedList = ""; // Remove the commas, if any, and replace them with spaces // while( $substitutedList != $list ) { // Do this only after the first time. // if( $substitutedList != "" ) { $list = $substitutedList; } $substitutedList = `substitute $regExpr $list $replaceWith`; } // Check if $llist is empty. // if( size( $list ) == 0 ) { return 0; } tokenize( $list, $tokenizedList ); return 1; }