Re: When can String.enumerateSubstringsInRange ever pass in NIL?
Re: When can String.enumerateSubstringsInRange ever pass in NIL?
- Subject: Re: When can String.enumerateSubstringsInRange ever pass in NIL?
- From: Ken Thomases <email@hidden>
- Date: Sat, 28 May 2016 23:08:44 -0500
On May 28, 2016, at 8:27 PM, Daryle Walker <email@hidden> wrote:
>
> The last argument to the method is a closure with four parameters. The first argument is an optional String. I can't think of a circumstance where it'll be NIL. (I need to know for testing.) Especially since it can be recreated in terms of the callback's second argument, which isn't optional. (So the string can be empty at worst.). Am I missing something, or is this a bug (and should be non-optional)?
One can pass NSStringEnumerationOptions.SubstringNotRequired in the options to tell the framework to not bother creating that substring, which can be expensive, if you don't need it. In that case, it will pass nil to your block.
Regards,
Ken
_______________________________________________
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