Re: case-insensitive strings
Re: case-insensitive strings
- Subject: Re: case-insensitive strings
- From: "Clark S. Cox III" <email@hidden>
- Date: Thu, 10 Oct 2002 14:25:21 -0400
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thursday, Oct 10, 2002, at 14:00 US/Eastern, Chris Ridd wrote:
On 10/10/02 5:48 pm, Matt Neuburg <email@hidden> wrote:
On Mon, 7 Oct 2002 10:32:22 -0700, I <email@hidden> said:
I'd like to have a kind of NSString where isEqual: is
case-insensitive. The
reason I want this...
[snip]
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
I didn't get any useful answers. The thing that amazes me is that no
one
chimed in with outraged cries of how the NSString model is inadequate.
Doesn't this bother anyone else out there besides me? This thing is an
object; the whole point of having an object is that the knowledge of
how to
do stuff, such as decide whether two instance are "equal", should be
made
to reside in the object. The idea that you can't flip case
sensitivity on
or off for an individual string instance is just nutty to me. The
idea of
having to do case-insensitive comparison "from the outside" makes me
barf.
The idea of having to do it by making both comparands uppercase makes
me
barf twice. I do it, but I also do a lot of barfing. m.
This is particularly barf-worthy since CoreFoundation has supported
case-insensitive compares since 10.0:
res = CFStringCompare(str1, str2, kCFCompareCaseInsensitive);
It's already there. From NSString.h:
- - (NSComparisonResult)compare:(NSString *)string;
- - (NSComparisonResult)compare:(NSString *)string options:(unsigned)mask;
- - (NSComparisonResult)compare:(NSString *)string options:(unsigned)mask
range:(NSRange)compareRange;
- - (NSComparisonResult)compare:(NSString *)string options:(unsigned)mask
range:(NSRange)compareRange locale:(NSDictionary *)dict;
- - (NSComparisonResult)caseInsensitiveCompare:(NSString *)string;
- - (NSComparisonResult)localizedCompare:(NSString *)string;
- - (NSComparisonResult)localizedCaseInsensitiveCompare:(NSString
*)string;
- --
http://homepage.mac.com/clarkcox3/
email@hidden
Clark S. Cox, III
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (Darwin)
iEYEARECAAYFAj2lxhYACgkQd6STocYT1xXQgwCfea7yiQp28VZrM6UfekDcEyd8
zNwAmQGQlAvj50pRU/vtG8WxX0h9JsA1
=a2Qo
-----END PGP SIGNATURE-----
_______________________________________________
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.