Re: OK to use setCharactersToBeSkipped:nil ?
Re: OK to use setCharactersToBeSkipped:nil ?
- Subject: Re: OK to use setCharactersToBeSkipped:nil ?
- From: Marco Scheurer <email@hidden>
- Date: Fri, 30 Jan 2004 16:40:55 +0100
On Jan 30, 2004, at 4:04 PM, Mason Mark wrote:
Yes, that is correct.
There is some default value for characters to be skipped
([NSCharacterSet whitespaceCharacterSet] I think), but your line of
code is common and will work as you intend.
I think the question was:" is [someScanner
setCharactersToBeSkipped:nil] as valid as [someScanner
setCharactersToBeSkipped:[NSCharacterSet emptyCharacterSet]], and is it
going to stay that way?"
The answer is not so obvious. Some methods do not like nil parameters.
Others specify what the behavior is when passed nil. In the case
setCharactersToBeSkipped:, nothing is said. Obviously, passing nil
could lead to many possible problems if the implementation changes.
There's also no +emptyCharacterSet method (although one can be created
for instance with [NSCharacterSet
characterSetWithCharactersInString:@""] or [[[NSCharacterSet alloc]
init] autorelease]). This makes it more likely that nil is expected to
be used if you want not to skip characters, but this should probably be
put in writing in the doc.
Marco Scheurer
Sen:te, Lausanne, Switzerland
http://www.sente.ch
_______________________________________________
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.