Re: NSScanner problem...
Re: NSScanner problem...
- Subject: Re: NSScanner problem...
- From: Koen van der Drift <email@hidden>
- Date: Sun, 3 Aug 2003 08:45:26 -0400
On Sunday, August 3, 2003, at 04:21 AM, Stephan Lichtenauer wrote:
NSString *file = [NSString stringWithContentsOfFile:@"FILE.TXT"];
NSArray *arrayWithLines = [file
componentsSeparatedByString:@"\n"];
This should give you an array with one NSString per line.
But only if the linebreaks are \n. This will fail if the text has
different type of linebreaks. In the latter case you could use the
function - (void)getLineStart:(unsigned *)startIndex end:(unsigned
*)lineEndIndex contentsEnd:(unsigned *)contentsEndIndex
forRange:(NSRange)aRange. IIRC, there is an example in the archives.
- Koen.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.