• 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 problem...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSScanner problem...


  • Subject: NSScanner problem...
  • From: Onar Vikingstad <email@hidden>
  • Date: Sun, 21 Apr 2002 21:39:38 +0200

I'm having a wierd problem I can't figure out with NSScanner. When I use setCharactersToBeSkipped in the second last line (as shown in my code), only the first " gets skipped, not the second one at the end of the string. [thisLine self] originally is:

Name "hey hey"

but the actual value of name string which is specified at intoString will be:

hey hey"


This is the code I'm using now:

NSScanner *scanString = [[NSScanner alloc] initWithString:[thisLine self]];
NSString *name;

[scanString scanString:@"Name" intoString:nil];
[scanString setScanLocation: [scanString scanLocation]+1 ];
[scanString setCharactersToBeSkipped:[NSCharacterSet characterSetWithCharactersInString:@"\"'"]];
[scanString scanUpToString:@"\n" intoString:&name];


Is this the way it's supposed to work? How can I get it to skip also the last " ?
_______________________________________________
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 problem...
      • From: Bill Cheeseman <email@hidden>
  • Prev by Date: Cocoa, ATSUI, and graphics context
  • Next by Date: Re: Compile times.
  • Previous by thread: Re: Cocoa, ATSUI, and graphics context
  • Next by thread: Re: NSScanner problem...
  • Index(es):
    • Date
    • Thread