• 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
Re: NSScanner off-by-one and I can't see why...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSScanner off-by-one and I can't see why...


  • Subject: Re: NSScanner off-by-one and I can't see why...
  • From: Alastair Houghton <email@hidden>
  • Date: Thu, 30 Apr 2009 13:10:47 +0100

On 30 Apr 2009, at 12:45, Graham Cox wrote:

The result for the above string should be keys @"city", @"state", @country" with ranges {0,6}, {7,7} and {15,9} respectively. The ranges include the delimiter characters while the keys do not. The results I actually get are correct keys, but ranges {0,6}, {6,7} and {14,9}. The spaces don't appear to have been counted, but I'm unclear why that is.

Anyone spot my mistake?

You need

  [scanner setCharactersToBeSkipped:nil];

If you look at -scanUpToString:intoString:'s docs, you'll see that it says that it returns NO (implying that it didn't scan any characters) if the only scanned characters are in the to-skip character set.

Kind regards,

Alastair.

--
http://alastairs-place.net



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSScanner off-by-one and I can't see why...
      • From: Graham Cox <email@hidden>
References: 
 >NSScanner off-by-one and I can't see why... (From: Graham Cox <email@hidden>)

  • Prev by Date: NSScanner off-by-one and I can't see why...
  • Next by Date: Re: NSScanner off-by-one and I can't see why...
  • Previous by thread: NSScanner off-by-one and I can't see why...
  • Next by thread: Re: NSScanner off-by-one and I can't see why...
  • Index(es):
    • Date
    • Thread