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

str_split_1 errors for empty character vector #504

Closed
jl5000 opened this issue Mar 16, 2023 · 1 comment
Closed

str_split_1 errors for empty character vector #504

jl5000 opened this issue Mar 16, 2023 · 1 comment

Comments

@jl5000
Copy link

jl5000 commented Mar 16, 2023

It would be useful if it just returned the original empty vector.

stringr::str_split_1(character(), " ")
#> Error in `stringr::str_split_1()`:
#> ! `string` must be a single string, not an empty character vector.

Created on 2023-03-16 by the reprex package (v2.0.1)

@hadley
Copy link
Member

hadley commented Aug 4, 2023

I think the existing behaviour is correct because it requires a character vector of length 1.

@hadley hadley closed this as completed Aug 4, 2023
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

No branches or pull requests

2 participants