Closed jroimartin closed 9 years ago
I think this would be a good idea, there's been times I've needed to do something like this and I've either gone with the duplicate code or just gone with the empty string, so a slice would be pretty sweet.
So do I (+1)
Finally, after trying it, I decided to discard this change. It adds complexity to the API and breaks with the conventions followed by the rest of functions. Also, it can be easily replaced by a for loop or so.
Then you could transform this kind of code:
Into something like this: