diff --git a/ChangeLog b/ChangeLog index a274bf3a8..1481eff96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-07-23 Wolfgang Sourdeau + + * SoObjects/SOGo/NSArray+Utilities.m (-trimmedComponents): new + method that returns a trimmed/stripped version of the strings + contained in the array. + 2009-07-22 Cyril Robert * UI/Scheduler/UIxCalListingActions.m: Added "editable" field to tasks, so diff --git a/SoObjects/SOGo/NSArray+Utilities.h b/SoObjects/SOGo/NSArray+Utilities.h index 4f9cf4aab..48417ac26 100644 --- a/SoObjects/SOGo/NSArray+Utilities.h +++ b/SoObjects/SOGo/NSArray+Utilities.h @@ -43,6 +43,8 @@ - (BOOL) containsCaseInsensitiveString: (NSString *) match; +- (NSArray *) trimmedComponents; + #ifdef GNUSTEP_BASE_LIBRARY - (void) makeObjectsPerform: (SEL) selector withObject: (id) object1 diff --git a/SoObjects/SOGo/NSArray+Utilities.m b/SoObjects/SOGo/NSArray+Utilities.m index 913ecdb17..d5f8443c0 100644 --- a/SoObjects/SOGo/NSArray+Utilities.m +++ b/SoObjects/SOGo/NSArray+Utilities.m @@ -115,12 +115,8 @@ flattenedArray = [NSMutableArray array]; objects = [self objectEnumerator]; - currentObject = [objects nextObject]; - while (currentObject) - { - [flattenedArray addObjectsFromArray: currentObject]; - currentObject = [objects nextObject]; - } + while ((currentObject = [objects nextObject])) + [flattenedArray addObjectsFromArray: currentObject]; return flattenedArray; } @@ -196,6 +192,23 @@ return response; } +- (NSArray *) trimmedComponents +{ + NSMutableArray *newComponents; + NSString *currentString; + unsigned int count, max; + + max = [self count]; + newComponents = [NSMutableArray arrayWithCapacity: max]; + for (count = 0; count < max; count++) + { + currentString = [[self objectAtIndex: count] stringByTrimmingSpaces]; + [newComponents addObject: currentString]; + } + + return newComponents; +} + @end @implementation NSMutableArray (SOGoArrayUtilities)