• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSScanner know-how
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • RE: NSScanner know-how
      • From: "Jonathan E. Jackel" <email@hidden>
    • RE: NSScanner know-how
      • From: "Jonathan E. Jackel" <email@hidden>
    • Re: NSScanner know-how
      • From: Jérôme Laurens <email@hidden>
  • Prev by Date: Re: Dockless app?
  • Next by Date: Re: flummoxed by math failure
  • Previous by thread: Re: Dockless app?
  • Next by thread: Re: NSScanner know-how
  • Index(es):
    • Date
    • Thread