NSString question – rangeOfString method

From the documentation of NSString

-[NSString rangeOfString]

Return Value

An NSRange structure giving the
location and length in the receiver of
the first occurrence of aString.
Returns {NSNotFound, 0} if aString is
not found or is empty (@””).

So it looks like:

if ([@"abc" rangeOfString:@"d"].location == NSNotFound){
  //Do something

Is the Apple-approved way.

EDIT:

I made a really bad typo, fixed it, thanks Kalle.

Leave a Comment

tech