I altered str_split and str_split_fixed to suppress the leading "" when splitting on "". See Issue 12.
removed sentence regarding default value of n for str_split_fixed
changed str_split_fixed to suppress leading "" from output when split…
…ting on ""
changed str_split to suppress leading "" when splitting on ""
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 == ""?
pattern == ""
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?
Fixed in stringi branch