Re: Simple File Data Reading Question
Re: Simple File Data Reading Question
- Subject: Re: Simple File Data Reading Question
- From: Sam Daniel <email@hidden>
- Date: Wed, 11 Feb 2004 11:42:22 -0700
Hi Daniel,
Thank you for your response,
> If your file is just a text file, It might be easier to do:
> NSString *someString = [NSString stringWithContentsOfFile:filePath];
> NSArray *someArray = [someString componentsSeparatedByString:@" "];
I actually used the implementation suggested by Jail (user at
macos-dev) by overriding
(BOOL)readFromFile:(NSString *)fileName ofType(NSString *)docType
However, by using @" " as the component delimiter, I found it not as
useful as one might want. I was surprised to find out that the code
worked fine for multi-line entries of 3 integers separated by one
space, assuming that the first line had no leading space at all! What
is needed here is a means to filter white space or any other
delimiters. After scouring the NSString and NSCharacterSet classes, I
could not find what I needed to accomplish this easily. It appears
that one would have to write a special method that looks at all the
characters of the retrieved string and extract the identified
components. When I did that I was surprised to see what appear to be
unicode characters (although I don't know what those are) for which the
content did not have a one to one correspondence. I will keep trying.
Regards,
Sam Daniel
_______________________________________________
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.