Re: NSTextView - read line by line?
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.