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

RE: Re: NSScanner problem[SOLVED]


  • Subject: RE: Re: NSScanner problem[SOLVED]
  • From: "Peter Karlsson" <email@hidden>
  • Date: Sat, 2 Oct 2004 11:18:17 +0200

Thanks a lot!

I'm very impressed what Cocoa can do with just a few lines of code...

Peter

Ursprungligt meddelande

>
>
> > 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:
>
> - (NSArray *)componentsSeparatedByString:(NSString *)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:
>
> NSString *list = @"wrenches, hammers, saws";
>
> NSArray *listItems = [list componentsSeparatedByString:@", "];
>
> 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

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