From 026c34f40e333b61ab97731a680e87092fe4598b Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 1 Jun 2007 04:13:22 +0000 Subject: [PATCH] Monotone-Parent: fab115ed2ae60866132f76c69f795a2388ec8672 Monotone-Revision: efa84a74ea15b6e14fe062eda5a4631b23b044f4 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-06-01T04:13:22 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 4 ++++ SoObjects/SOGo/NSArray+Utilities.h | 2 ++ SoObjects/SOGo/NSArray+Utilities.m | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+) 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)