splitting on "" #23

wants to merge 3 commits into


None yet

2 participants

I altered str_split and str_split_fixed to suppress the leading "" when splitting on "". See Issue 12.

hadley commented Mar 13, 2013

I would prefer to fix it in str_locate_all so that the two stringr functions remain consistent. Would you mind taking a look and seeing how hard that would be? Thanks!

I guess it depends on how consistently you want str_locate_all to behave. Somehow we have to catch when pattern == "". If we do that within str_locate_all, then that function no longer behaves the same way as gregexpr. Maybe a better approach is to define a common helper function for str_split and str_split_fixed that's only invoked when pattern == ""?

hadley commented Mar 18, 2013

Hmmm, I would prefer that stringr be internal consistent. If that means it can't be perfectly consistent with the existing regular expression functions then so be it.

Or maybe str_split should ignore split locations that are either at the first or the last position of the string?

hadley commented Nov 26, 2014

Fixed in stringi branch

@hadley hadley closed this Nov 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment