Jess
Jess

Reputation: 23

Range of substring in string

Is the a way to get the NSRange of an NSString in an NSString?

Upvotes: 1

Views: 3800

Answers (2)

Nikolai Ruhe
Nikolai Ruhe

Reputation: 81858

You're making this up, right? Or is there some hidden clue in your question that makes rangeOfString: the wrong answer?

Upvotes: -3

harms
harms

Reputation: 8796

Did you look in the documentation?

NSString has the following method:

- (NSRange)rangeOfString:(NSString *)aString

The NSString class reference at developer.apple.com says of this method:

Finds and returns the range of the first occurrence of a given string within the receiver.

Upvotes: 8

Related Questions