• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSScanner problem...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Re: NSScanner problem... (From: Stephan Lichtenauer <email@hidden>)

  • Prev by Date: Invisible Characters
  • Next by Date: Screen Resolution
  • Previous by thread: Re: NSScanner problem...
  • Next by thread: Custom File Icons?
  • Index(es):
    • Date
    • Thread