Re: NSScanner bug?
Re: NSScanner bug?
- Subject: Re: NSScanner bug?
- From: Jérôme Laurens <email@hidden>
- Date: Tue, 22 Oct 2002 15:54:36 +0200
Le mardi, 22 oct 2002, ` 14:56 Europe/Zurich, Mark's Studio a icrit :
I am trying to scan a text file, and i use this
if([theScanner scanUpToString:@"ABC" intoString:NULL])
if the textfile contains "ABC" at the beginning the scanner will not
find it, and it will not find the next "ABC".
BUG???
no,
the doc says that this method returns YES if some characters have been
scanned NO otherwise.
It stops just before the stopString!
you can code like this
if([theScanner scanUpToString: @"ABC" intoString: nil], [theScanner
scanString: @"ABC" intoString: nil])
{
//do your job
}
or
if([theScanner scanUpToString: @"ABC" intoString: nil], ![theScanner
isAtEnd])
{
[theScanner setScanLocation: [theScanner scanLocation]+3];// 3 for
[@"ABC" length]
//do your job
}
it is not very efficient...
_______________________________________________
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.