RE: NSScanner know-how
RE: NSScanner know-how
- Subject: RE: NSScanner know-how
- From: "Jonathan E. Jackel" <email@hidden>
- Date: Fri, 25 Jul 2003 16:55:39 -0400
Here is my ORIGINAL response:
http://cocoa.mamasam.com/COCOADEV/2003/07/2/69033.php
Essentially, you have a C problem (your if() always stops evaluating
prematurely after the first time through the loop), not a scanner problem.
Jonathan
>
-----Original Message-----
>
From: email@hidden
>
[mailto:email@hidden]On Behalf Of Sanri Parov
>
Sent: Wednesday, July 23, 2003 6:02 PM
>
To: email@hidden
>
Subject: NSScanner know-how
>
>
>
Hi everybody,
>
>
I'm in little trouble with NSScanner, just because it's not well
>
documented IMHO in the developer docs.
>
Given this puny little source text:
>
>
#id:15;
>
#customer:F.lli Remari;
>
#phone:123456789;
>
#cell:13456;
>
#fax:987987;
>
#id:16;
>
#customer:Zanovello Nicola;
>
#phone:456789;
>
#cell:;
>
#fax:12356;
>
>
I'd like to import the right-values to some variables.
>
Here's the source I've done by copying the example from the docs...
>
>
NSString* id_origin = @"#id:";
>
NSStrign* id_sql;
>
NSCharacterSet *semicolonSet;
>
NSScanner *scanner;
>
semicolonSet = [NSCharacterSet characterSetWithCharactersInString:@";"];
>
scanner = [NSScanner scannerWithString:stringa_da_file];
>
>
>
while ([scanner isAtEnd] == NO)
>
{
>
if([scanner scanString:id_origin intoString:NULL] && [scanner
>
scanUpToCharactersFromSet:semicolonSet intoString:&id_sql] && [scanner
>
scanString:@";" intoString:NULL])
>
NSLog(@"%@",id_sql);
>
}
>
>
>
.. but the whole routine hangs after having seen the first ID.
>
Maybe it's just because I'm very tired and sleepy, but I can't see the
>
point.
>
Any help is really appreciated.
>
>
--
>
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.
_______________________________________________
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.