Re: Dividing Strings
Re: Dividing Strings
- Subject: Re: Dividing Strings
- From: Chuck Rice <email@hidden>
- Date: Sun, 12 Jan 2003 22:30:14 -0800
Actually, it was not in the Docs. I tend to look far and wide. I read it at:
<
http://www.cocoadev.com/index.pl?NSScanner>
Not a very official source I guess. :) -Chuck-
no.. it's not deprecated...
if this was in the docs, let me know and I'll file a bug (and fix it.. :-)
On Monday, January 13, 2003, at 12:53 AM, Chuck Rice wrote:
At 10:32 PM -0700 1/12/03, Alex Rice wrote:
On Sunday, January 12, 2003, at 10:13 PM, Chuck Rice wrote:
My question is, is there a better function to accomplish this, or
will I need to do the parsing the hard way with a loop, looking
at each character? Cocoa seems to have a really rich feature set,
so I thought there might be a better way. Any help would be
appreciated. I have spent a lot of time looking, but there is an
awful lot of doc to see. -Chuck-
AFAIK there is no actual regular expressions support in Cocoa, but
the next best thing is NSScanner, which you could definitely use
to parse the records.
Thanks. I am using NSScanner to parse the lines out:
LineSet = [NSCharacterSet characterSetWithCharactersInString:@"\r\n"];
lineScanner = [NSScanner scannerWithString:aString];
while ([lineScanner isAtEnd] == NO) {
scanResult = [lineScanner scanUpToCharactersFromSet:LineSet
intoString:&aLine];
NSLog(@"-%@-",aLine);
listItems = [aLine componentsSeparatedByString:@","];
[lines addObject:listItems];
}
But I read somewhere that it was Deprecated. Is that true? I did
not want to rely too much on it. -Chuck-
_______________________________________________
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.
_______________________________________________
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.