• 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: NSTextView - read line by line?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextView - read line by line?


  • Subject: Re: NSTextView - read line by line?
  • From: Ian James <email@hidden>
  • Date: Wed, 16 Apr 2003 20:05:01 -0400

I had the same problem. After searching archives, I found this solution...


NSString *stringFromFile = [[NSString alloc] initWithContentsOfFile:filepath]; //Make file a string
NSArray *lineArray = [stringFromFile componentsSeparatedByString:@"\n"]; //Then use this handy NSArray function
[stringFromFile release];



Now the entire file is stored line by line in an array called lineArray.

The NSArray functions allow you to get whatever line you want. And each line is a separate string. (It's great).

The "\n" is used as the point where each new string is created.


Just read the NSArray doc. Its easy
_______________________________________________
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: 
 >NSTextView - read line by line? (From: Steve Woodward <email@hidden>)

  • Prev by Date: Re: NSTableView and Scrollbars
  • Next by Date: Re: PB hangs forever when compiling
  • Previous by thread: Re: NSTextView - read line by line?
  • Next by thread: RE: Saving an array in NSUserDefaults
  • Index(es):
    • Date
    • Thread