Re: NSScanner problem
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