Still having problems with NSScanner on Mac OS X 10.1.x
Still having problems with NSScanner on Mac OS X 10.1.x
- Subject: Still having problems with NSScanner on Mac OS X 10.1.x
- From: Simone Manganelli <email@hidden>
- Date: Sat, 16 Nov 2002 20:18:10 -0800
Hey everyone --
I'm still having problems with an NSScanner class on Mac OS X 10.1.x.
As I said before, my application uses an NSScanner class to parse some
command line output
into data that gets put into a table view. On Mac OS X 10.2 Jaguar, my
application works as expected. However, under Mac OS X 10.1.x, any data
that got parsed via an NSScanner class does not display correctly in the
NSTableView it displays the wrong parts of the strings that should
have been parsed. However, data that was parsed simply via the NSString
methods do not exhibit this problem under Mac OS X 10.1.x. Only
NSScanner parsed data has this problem.
Is there any way to fix this problem and make my application work under
both operating systems? Any help would be greatly appreciated. If
there's another way to accomplish what NSScanner does, that would be
acceptable too, as long as it works under both Mac OS X 10.1.x and
10.2.x Jaguar.
Here's the code that I am using to parse the output of the command line:
// sets the full command of the process
- (void)setFullProcessName:(NSString *)n;
{
NSScanner *scanner;
NSString *tempString = nil;
[n retain];
[fullProcessName release];
fullProcessName = n;
// inits the scanner with the last part of the full command of the
process
scanner = [[NSScanner alloc] initWithString:[[fullProcessName
componentsSeparatedByString:@"/"] lastObject]];
[scanner setCaseSensitive:YES];
[scanner scanUpToString:@"console" intoString:&tempString];
// checks if the word "console" appears if it doesn't, searches
for "psn"
if ([[[fullProcessName componentsSeparatedByString:@"/"]
lastObject] isEqualToString:tempString]) {
[scanner setScanLocation:0];
[scanner scanUpToString:@"-psn" intoString:&tempString];
} else if (![tempString length]) {
tempString = [[fullProcessName
componentsSeparatedByString:@"/"] lastObject];
} else {
[scanner scanString:@"console" intoString:NULL];
}
// sets the process name
[self setProcessName:tempString];
[scanner release];
}
Thanks for any help that people can give.
-- Simone Manganelli
_______________________________________________
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.