RE: Re: NSScanner problem[SOLVED]
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