redndahead 0 Posted August 30, 2004 Share Posted August 30, 2004 Here is a udf I wrote that will trim all the items in an array a specified amount. http://www.autoitscript.com/fileman/users/red/udfs/_arraytrim.au3 ;=============================================================================== ; ; Description: Trims all elements in an array a certain number of characters. ; Syntax: _ArrayTrim( $aArray, $iTrimNum , $iTrimDirection ) ; Parameter(s): $aArray - The array to trim the items of. ; $iTrimNum - The amount of characters to trim. ; $iTrimDirection - 0 to trim left, 1 to trim right ; Requirement(s): None ; Return Value(s): 0 - If invalid array ; Otherwise it returns the new trimmed array ; Author(s): Adam Moore (redndahead) ; Note(s): None ; ;===============================================================================Here is some sample code. $DaysOfWeek = 'Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday' $WeekArray = StringSplit($DaysOfWeek,'|') $NewWeekArray = _ArrayTrim($WeekArray,1,1) For $i = 1 to Ubound($NewWeekArray) $WeekText = $WeekText & @CRLF & $NewWeekArray[$i] Next MsgBox(0,'Trimmed Days of the Week',$WeekText) Exit Output should be: Monda Tuesda Wednesda Thursda Frida Saturda Sunda Hope it's useful. =) red Link to post Share on other sites
redndahead 0 Posted August 31, 2004 Author Share Posted August 31, 2004 In case anyone was using it I updated it to only accept 0 and 1 for which trim you wanted. Also returns 1 if 0 or 1 is not selected. Same link as above. =) red Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now