Re: Substring in String?
Re: Substring in String?
- Subject: Re: Substring in String?
- From: Jim Correia <email@hidden>
- Date: Sun, 17 Feb 2002 13:22:00 -0500
On Sunday, February 17, 2002, at 01:08 PM, Finlay Dobbie wrote:
On Sunday, February 17, 2002, at 05:26 PM, Ondra Cada wrote:
if ([s rangeOfString:ss].length) ...
Shouldn't that be
if ([s rangeOfString:ss].length != NSNotFound) ...
It is probably stylistically better to say
if ([s rangeOfString: ss] != NSNotFound)
{
}
However, the documentation states that the range {NSNotFound, 0} is
returned if the string isn't found, so the first test would also be
valid way to test for success.
NSNotFound should never be returned in the length field, so your test
should never be a valid way to test for success.
Jim
_______________________________________________
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.