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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to