Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ausername

macrumors newbie
Original poster
Feb 28, 2009
25
0
Hello, I am looking for a way to tell if a string contains another string. Something like this...

if ([thisLetter isIn: theParagraph]) {

... //do something

}


or maybe:
if ([theParagraph contains: thisLetter]) {

... //do something

}

but sadly those are not real methods... So, does anyone know of a way to do this? any help would be great, thanks. :)
 
I'd suggest reading the section of the NSString class documentation titled "Finding Characters and Substrings". While there isn't an explicit boolean "contains:" method, there are several that should be close enough, with a little logic.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.