diff --git a/ChangeLog b/ChangeLog index 45be185ab..062f7036e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2007-06-01 Wolfgang Sourdeau + * SoObjects/SOGo/NSArray+Utilities.m ([NSArray + -containsCaseInsensitiveString:match]): an enhanced version of + containsObject:. + * UI/MailerUI/UIxMailView.m ([-isTrashingAllowed]): removed useless method. ([-showMarkDeletedButton]): removed useless method. diff --git a/SoObjects/SOGo/NSArray+Utilities.h b/SoObjects/SOGo/NSArray+Utilities.h index 025b2bcea..b330cf854 100644 --- a/SoObjects/SOGo/NSArray+Utilities.h +++ b/SoObjects/SOGo/NSArray+Utilities.h @@ -33,6 +33,8 @@ - (NSArray *) stringsWithFormat: (NSString *) format; +- (BOOL) containsCaseInsensitiveString: (NSString *) match; + #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 66054efb8..77dabdcbd 100644 --- a/SoObjects/SOGo/NSArray+Utilities.m +++ b/SoObjects/SOGo/NSArray+Utilities.m @@ -81,6 +81,26 @@ return representation; } +- (BOOL) containsCaseInsensitiveString: (NSString *) match +{ + BOOL response; + NSString *currentString, *cmpObject; + NSEnumerator *objects; + + response = NO; + + cmpObject = [match lowercaseString]; + objects = [self objectEnumerator]; + currentString = [objects nextObject]; + while (currentString && !response) + if ([[currentString lowercaseString] isEqualToString: cmpObject]) + response = YES; + else + currentString = [objects nextObject]; + + return response; +} + @end @implementation NSMutableArray (SOGoArrayUtilities)