• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Search NSString for a word and get a boolean value
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Search NSString for a word and get a boolean value


  • Subject: Re: Search NSString for a word and get a boolean value
  • From: John Bishop <email@hidden>
  • Date: Fri, 11 Jul 2008 18:47:06 -0500
  • X_cmae_category: 0,0 Undefined,Undefined

Moritz Siller <email@hidden> said:

For the first occurrence:

BOOL found = ([myString rangeOfString:@"*** FLOP ***"].location != NSNotFound);

which you could have easily found in the "FInding Characters and Substrings" section of the NSString Class Reference documentation.  Happy coding.


>I have a string and I want to search it for the word "*** FLOP ***"
>and get a simple boolean value to know if the string contains this word.
>
>I have tried with the NSScanner class` methods, but i am not even sure
>if they are made for that purposes.
>Is there a simple method to do the job? Are the NSScanner methods the
>right way and I am just handling them wrong?
>
>If you think this question is too stupid and i should solve it on my
>own please just ignore it ;-)
>
>Greetings, Moritz.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Learning How to Program in Objective-C
  • Next by Date: Re: NSSpeechSynthesizer lifetime and garbage collected (GC) applications
  • Previous by thread: Re: Search NSString for a word and get a boolean value
  • Next by thread: XCode 3.1 quits each time after launch
  • Index(es):
    • Date
    • Thread