FROM : Andy Lee
DATE : Thu Oct 10 21:26:38 2002
Oops, of course I realized I had a bug the second after I hit "Send".
Here's a correction:
// (still) completely untested code:
- (NSArray *)keysForCaseInsensitiveString:(NSString *)aString
inDictionary:(NSDictionary *)aDictionary
{
NSMutableArray *resultKeys = [NSMutableArray array];
NSEnumerator *keyEnum = [aDictionary keyEnumerator];
id key;
while ((key = [keyEnum nextObject]))
{
id value = [aDictionary objectForKey:key];
if ([value isKindOfClass:[NSString class]])
{
if ([value caseInsensitiveCompare:aString] == NSOrderedSame)
{
[resultKeys addObject:key];
}
}
}
return resultKeys; // convert to an immutable NSArray first if you like
}
--Andy
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
DATE : Thu Oct 10 21:26:38 2002
Oops, of course I realized I had a bug the second after I hit "Send".
Here's a correction:
// (still) completely untested code:
- (NSArray *)keysForCaseInsensitiveString:(NSString *)aString
inDictionary:(NSDictionary *)aDictionary
{
NSMutableArray *resultKeys = [NSMutableArray array];
NSEnumerator *keyEnum = [aDictionary keyEnumerator];
id key;
while ((key = [keyEnum nextObject]))
{
id value = [aDictionary objectForKey:key];
if ([value isKindOfClass:[NSString class]])
{
if ([value caseInsensitiveCompare:aString] == NSOrderedSame)
{
[resultKeys addObject:key];
}
}
}
return resultKeys; // convert to an immutable NSArray first if you like
}
--Andy
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
| Related mails | Author | Date |
|---|---|---|
| Matt Neuburg | Oct 7, 19:32 | |
| Jonathan E. Jackel | Oct 7, 22:55 | |
| Ando Sonenblick | Oct 8, 09:06 | |
| Matt Neuburg | Oct 10, 18:48 | |
| Ondra Cada | Oct 10, 19:36 | |
| Ali Ozer | Oct 10, 19:41 | |
| Chris Ridd | Oct 10, 20:00 | |
| Clark S. Cox III | Oct 10, 20:25 | |
| Andy Lee | Oct 10, 21:21 | |
| Andy Lee | Oct 10, 21:26 | |
| Chris Ridd | Oct 10, 22:01 | |
| Ondra Cada | Oct 10, 22:52 | |
| Phillip Hutchings | Oct 10, 23:38 | |
| matt neuburg | Oct 11, 00:26 | |
| matt neuburg | Oct 11, 00:53 | |
| Nat! | Oct 11, 01:39 | |
| Marcel Weiher | Oct 11, 09:06 |






Cocoa mail archive

