Re: NSScanner problem...
Re: NSScanner problem...
- Subject: Re: NSScanner problem...
- From: Jeff LaMarche <email@hidden>
- Date: Sun, 3 Aug 2003 14:23:26 -0400
Thanks for the feedback. Unfortunately, the string I'm parsing can
potentially be very, very large, so I was hesitant to split it up into
arrays prior to processing, because then I have to split all lines even
if the header's only 2 lines long...
I got things working by playing around a little, however...
On Sunday, August 3, 2003, at 04:21 AM, Stephan Lichtenauer wrote:
>
this does not exactly answer your question, but there is an (in my
>
eyes...) easier solution to split a string line after line:
>
>
NSString *file = [NSString stringWithContentsOfFile:@"FILE.TXT"];
>
NSArray *arrayWithLines = [file componentsSeparatedByString:@"\n"];
>
>
This should give you an array with one NSString per line.
>
>
So (I have not tried this but it should work) if you search for "\n\n"
>
for example you should get exactly the header as the first array item,
>
which you then could split further into single lines or whatever you
>
want to do with it.
_______________________________________________
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.