RE: case-insensitive strings
RE: case-insensitive strings
- Subject: RE: case-insensitive strings
- From: "Jonathan E. Jackel" <email@hidden>
- Date: Mon, 7 Oct 2002 16:55:51 -0400
Matt:
The way I usually do case-insensitive compares is to convert both sides of
the equality to uppercase or lowercase, via standard NSString methods, e.g.:
if ([[firstString uppercaseString] isEqualToString:[secondString
uppercaseString]])
Jonathan
>
-----Original Message-----
>
From: email@hidden
>
[mailto:email@hidden]On Behalf Of Matt Neuburg
>
Sent: Monday, October 07, 2002 1:32 PM
>
To: email@hidden
>
Subject: case-insensitive strings
>
>
>
I'd like to have a kind of NSString where isEqual: is
>
case-insensitive. The
>
reason I want this is so that when such a string is an object in a
>
dictionary, allKeysForObject will work case-insensitively. For example, if
>
I have a dictionary where both keys and objects are strings, like this:
>
>
yo: Hello
>
ha: Haha
>
>
...then if I say [dict allKeysForObject: @"hello"] I'd like to get back an
>
array consisting of @"yo".
>
>
Is there an elegant and safe way to do this? You'd think there would be a
>
way to tell an individual string to flip case sensitivity off for the
>
purpose of all comparisons, but there doesn't seem to be one built in. m.
>
--
>
>
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt
>
pantes anthropoi tou eidenai oregontai phusei
>
Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.