Re: how does one split a block of newline-separated text into an NSArray of NSStrings?
Re: how does one split a block of newline-separated text into an NSArray of NSStrings?
- Subject: Re: how does one split a block of newline-separated text into an NSArray of NSStrings?
- From: Stephan Cleaves <email@hidden>
- Date: Mon, 30 Oct 2006 17:02:52 -0500
I believe you are looking for NSString's
- (NSArray *)componentsSeparatedByString:(NSString *)separator
fdfdfdfSo for example
NSArray *components = [someString componentsSeparatedByString:@"\n"];
Stephan
On Oct 30, 2006, at 10:28 AM, mercer wrote:
Hi. What is the Cocoa way to take a block of text -- where each line
of text ends with a newline -- and fill an NSArray with NSStrings?
Each NSString would contain a single line of text.
In Perl, you'd do this:
@array = split (/\n/, $variable);
thanks,
m
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
camp.com
This email sent to email@hidden
_______________________________________________
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