Re: NSScanner know-how
Re: NSScanner know-how
- Subject: Re: NSScanner know-how
- From: Sanri Parov <email@hidden>
- Date: Fri, 25 Jul 2003 22:04:25 +0200
On Thu, 24 Jul 2003 00:22:58 +0200, Jirtme Laurens wrote:
>
>
replace your test by
>
> if([scanner scanString:id_origin intoString:NULL] && ([scanner
>
> scanUpToCharactersFromSet:semicolonSet intoString:&id_sql], [scanner
>
> scanString:@";" intoString:NULL]))
>
> NSLog(@"%@",id_sql);
>
>
this will prevent the problem of the line
[CUT]
Very nice try Jerome... but... it doesn't work! :-))
To be more precise, it hangs with the spinning cursor of death!!
I've tried with some single step-by-step parsing such as this:
while ([scanner isAtEnd] == NO)
{
okay = [scanner scanString:id_origin intoString:NULL];
NSLog(@"Scan location:%d", [scanner scanLocation]);
okay = [scanner scanUpToCharactersFromSet:semicolonSet
intoString:&id_sql];
NSLog(@"id = %@", id_sql);
okay = [scanner scanString:@";" intoString:NULL];
}
But here is what is returned:
2003-07-25 21:37:00.802 Rubrica[1081] Scan location:4
2003-07-25 21:37:00.803 Rubrica[1081] id = 15
2003-07-25 21:37:00.803 Rubrica[1081] Scan location:7
2003-07-25 21:37:00.803 Rubrica[1081] id = #customer:F.lli Remari
2003-07-25 21:37:00.803 Rubrica[1081] Scan location:30
2003-07-25 21:37:00.803 Rubrica[1081] id = #telefono:123456789
2003-07-25 21:37:00.803 Rubrica[1081] Scan location:51
2003-07-25 21:37:00.803 Rubrica[1081] id = #cellulare:13456
2003-07-25 21:37:00.804 Rubrica[1081] Scan location:69
2003-07-25 21:37:00.804 Rubrica[1081] id = #
fax:987987
2003-07-25 21:37:00.804 Rubrica[1081] Scan location:87
2003-07-25 21:37:00.804 Rubrica[1081] id = 16
2003-07-25 21:37:00.804 Rubrica[1081] Scan location:90
2003-07-25 21:37:00.804 Rubrica[1081] id = #customer:Zanovello Nicola
2003-07-25 21:37:00.804 Rubrica[1081] Scan location:117
2003-07-25 21:37:00.804 Rubrica[1081] id = #telefono:456789
2003-07-25 21:37:00.804 Rubrica[1081] Scan location:135
2003-07-25 21:37:00.804 Rubrica[1081] id = #cellulare:
2003-07-25 21:37:00.804 Rubrica[1081] Scan location:148
2003-07-25 21:37:00.804 Rubrica[1081] id = #
fax:12356
I can't understand why NSScanner seems to confuse '#id' with
'#customer'...
Where am I'm doing my mistake?
--
Sanri Parov
_______________________________________________
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.