Should String.prototype.split accept variable arguments optionally?

Andrea Giammarchi andrea.giammarchi at gmail.com
Wed Oct 16 10:18:45 PDT 2013


also, this is the same:

`myString.split(/[ -/+]/)`

maybe it's better to explain those users that knowing RegExp might bring
benefits for their purpose (coding) ?


On Wed, Oct 16, 2013 at 10:14 AM, Andrea Giammarchi <
andrea.giammarchi at gmail.com> wrote:

> I stopped here
>
>
> On Wed, Oct 16, 2013 at 5:54 AM, Benjamin (Inglor) Gruenbaum <
> inglor at gmail.com> wrote:
>
>>
>> ```
>>     myString.split(/ |-|\/|\+/g); // this is no fun to read
>>
>>     myString.split(" ","-","/","+"); // this is easier
>>     myString.split([" ","-","/","+"]); // this is also easier.
>>
>> ```
>>
>
>
> easier for who ?
>
> All I was doing is being sure no double quoting was missing or not escaped
> correctly ... also you don't need the g flag and RegExp is much more
> powerful than multiple strings
>
> `myString.split(/before(and|or)?after/);`
>
> instead of 3 partially repeated nonsense ?
>
> My 2 cents
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131016/a251766c/attachment.html>


More information about the es-discuss mailing list