Re: Substring in String?
Re: Substring in String?
- Subject: Re: Substring in String?
- From: Ondra Cada <email@hidden>
- Date: Sun, 17 Feb 2002 21:27:04 +0100
Finlay,
>
>>>>> Finlay Dobbie (FD) wrote at Sun, 17 Feb 2002 18:08:05 +0000:
FD> >if ([s rangeOfString:ss].length) ...
FD>
FD> Shouldn't that be
FD>
FD> if ([s rangeOfString:ss].length != NSNotFound) ...
Nope. See docs. Zero length means nothing was found. It is even quite intuitive.
NSNotFound should be returned in the location field. As you used it, it
would be an error. Besides, I had problems with that (don't remember
precisely -- either in GNUStep or in some older OpenStep release or perhaps
in Mac OS X Server 1 the location was undefined for "not find", whilst zero
length indicated "not found" properly anywhere I've tried so far).
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
2K Development: email@hidden
http://www.2kdevelopment.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.