Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

splitting on "" #23

Closed
wants to merge 3 commits into from
Closed

splitting on "" #23

wants to merge 3 commits into from

Conversation

galangjs
Copy link

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

@hadley
Copy link
Member

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!

@galangjs
Copy link
Author

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
Copy link
Member

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
Copy link
Member

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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants