Re: NSScanner (was Re: multiple componentsSeparatedByString)
Re: NSScanner (was Re: multiple componentsSeparatedByString)
- Subject: Re: NSScanner (was Re: multiple componentsSeparatedByString)
- From: Jonathan Jackel <email@hidden>
- Date: Fri, 29 Nov 2002 22:06:56 -0500
Have you looked at using scanCharactersFromSet:intoString: or NSString's
rangeOfCharacterFromSet:options:range: to test for whether the first
character is in the stop set?
Jonathan
on 11/29/02 2:02 PM, Koen van der Drift at email@hidden wrote:
>
>
> while (! [scanner isAtEnd])
>
> {
>
> if ([scanner scanUpToCharactersFromSet: stopSet intoString:&result] &&
>
> [scanner scanCharactersFromSet:stopSet intoString:&nil])
>
> {
>
> [anArray addObject:result];
>
> }
>
> }
>
>
There may be problem with this snippet. When the first character in the
>
scanned string is a member of stopSet, addObject will not be called, and
>
the while loop runs infinite. Is there a way around this?
>
>
thanks,
>
>
- Koen.
_______________________________________________
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.