• 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: NSScanner problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSScanner problem


  • Subject: Re: NSScanner problem
  • From: J Tichenor <email@hidden>
  • Date: Sat, 2 Oct 2004 10:09:37 +0100



Dear list!

I have a NSString looking like this:

"5, Apple, Cocoa, Macintosh, Programmer, Development"

I want to extract the strings in a loop, example:

First I get the string "5", then the string "Apple", then the string
"Cocoa" and so on. I think this is a job for NSScanner, can someone please
tell me how?


I think you want:

<x-tad-bigger>- (</x-tad-bigger><x-tad-bigger>NSArray</x-tad-bigger><x-tad-bigger> *)componentsSeparatedByString:(NSString *)</x-tad-bigger>separator
Returns an NSArray containing substrings from the receiver that have been divided by separator. The substrings in the array appear in the order they did in the receiver. If the string begins or ends with the separator, the first or last substring, respectively, is empty. For example, this code excerpt:

<x-tad-bigger>NSString *list = @"wrenches, hammers, saws";

NSArray *listItems = [list componentsSeparatedByString:@", "];</x-tad-bigger>


J _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >NSScanner problem (From: "Peter Karlsson" <email@hidden>)

  • Prev by Date: Fwd: Problems with NSFileHandle and à/ò/ì... chars
  • Next by Date: RE: Re: NSScanner problem[SOLVED]
  • Previous by thread: NSScanner problem
  • Next by thread: Re: NSScanner problem
  • Index(es):
    • Date
    • Thread