I need a way to see if an NSString is contains by another

Discussion in 'iOS Programming' started by ausername, Apr 13, 2009.

  1. macrumors newbie

    Joined:
    Feb 28, 2009
    #1
    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. :)
     
  2. macrumors 6502a

    Joined:
    Mar 19, 2008
    Location:
    North Shore, MA
    #2
    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.
     

Share This Page