Re: scannerWithString
Re: scannerWithString
- Subject: Re: scannerWithString
- From: zauhar <email@hidden>
- Date: Fri, 24 May 2002 08:27:25 -0400
- Scubber-version: 1.7 (portal)
Frank, in my case I did this - It puts each line of the input file into
a separate NSString object in the array. You can then make an NSScanner
instance for each line of the file and go from there.
- Randy
NSString *typeContents ;
NSArray *typeLines ;
// Get the file contents -----
typeContents = [ [ NSString alloc ] initWithContentsOfFile:f ] ;
// Divvy the file contents (lines) into an array of NSstrings
using \n as separator
typeLines = [ typeContents componentsSeparatedByString:@"\n" ] ;
On Friday, May 24, 2002, at 06:47 AM, Frank Blome wrote:
Hello together,
I just started my first cocoa development project. I want to write a
tool for editing UNIX configuration files. Most of the parts and
functions I need are pretty clear, because this great Cocoa framework,
but please allow me one question:
I load the current configuration file while awake(ing) from nib;
NSString *contents = [[NSString alloc]
initWithContentsOfFile:configFile];
After that, I figured out that "scannerWithString" might be the solution
for finding linefeeds (\n) in the configuration file and after that, put
every single line it into a NSMutableArray for further handling.
Is this the right approach? Or will there be a better way?
Thanks for help,
Frank
_______________________________________________
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.
Randy J. Zauhar, PhD
Assoc. Prof. of Biochemistry
Director, Graduate Program in Bioinformatics
Dept. of Chemistry & Biochemistry
University of the Sciences in Philadelphia
600 S. 43rd Street
Philadelphia, PA 19104
Phone: (215)596-8691
FAX: (215)596-8543
E-mail: email@hidden
Web:
http://tonga.usip.edu/zauhar
Thought for the ages:
"If you have conceptions of things that you can have no conception of,
then the conception and the thing appear to co-incide." -- C.G. Jung
Thought for the new millennium:
"Nothing is gooder than watching cartoons." -- Catherine Zauhar, age 5
_______________________________________________
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.