Re: searching a Unicode string in a text
Re: searching a Unicode string in a text
- Subject: Re: searching a Unicode string in a text
- From: Ondra Cada <email@hidden>
- Date: Fri, 20 Sep 2002 14:29:28 +0200
On Friday, September 20, 2002, at 12:52 , Ondra Cada wrote:
if( range.location == 0 && range.length == [string length] ) return
[[[NSString alloc] initWithString:@"1"] autorelease];
I don't quite follow this part.
- if you just wanted to know whether the string is at the beginning
("range.location==0"), you can use hasPrefix: instead of rangeOfString:;
- and (sorry, just now I've noticed I forgot to add), if you just wanted
to know whether those strings are equal, there's isEqualToString:.
Also, I am not sure in which extent this is actually implemented in the
current Foundation Kit, but at least in principle with Unicode it is
possible that [s1 isEqualToString:s2], but [s1 length]!=[s2 length] (due
to composite characters).
---
Ondra Hada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
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.