NSScanner know-how
NSScanner know-how
- Subject: NSScanner know-how
- From: Sanri Parov <email@hidden>
- Date: Thu, 24 Jul 2003 00:02:27 +0200
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.