Re: NSScanner bug?
Re: NSScanner bug?
- Subject: Re: NSScanner bug?
- From: "Mark's Studio" <email@hidden>
- Date: Tue, 22 Oct 2002 20:57:50 +0200
Yes i know, but why does it not return YES with a scanLocation of 0,
if i use scanUpToString@"BC" it will return YES with scanLocation 1.
On tirsdag, okt 22, 2002, at 15:54 Europe/Copenhagen, Jirtme Laurens
wrote:
>
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.
>
>
Peter Mark
Mark's Recording Studio A/S
Faelledvej 19 b DK2200 N
Copenhagen Denmark
Tel: +45 35366078 Fax: +45 35366038
www.marks-studio.dk
email@hidden
_______________________________________________
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.