On Mon, Aug 31, 2015 at 12:19 AM, LCD 47 <lcd...@gmail.com> wrote:

> On 30 August 2015, Yukihiro Nakadaira <yukihiro.nakada...@gmail.com>
> wrote:

...

> > Anyway, is it possible to change split()'s behavior to omit all empty
> > field (split(",,,x,,,y,,,") => ["x", "y"])?
>
>     You can achieve that by allowing multiple separators:
>
>         :echo split(',,,x,,,y,,,', '\m,\+')
>         ['x', 'y']
>
>     For reference, Perl and Ruby remove the trailing empty items by
> default, but not the leading ones:
>
>         $ perl -MData::Dumper -e 'print Dumper([split(",", ",,,x,,,")])'
>         $VAR1 = [
>                 '',
>                 '',
>                 '',
>                 'x'
>                 ];
>
>         $ ruby -e 'print ",,,x,,,".split(",")'
>         ["", "", "", "x"]
>

Indeed.  And they doesn't remove empty field in middle.  My suggestion is
not good idea.

-- 
Yukihiro Nakadaira - yukihiro.nakada...@gmail.com

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui