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

Adds a message when an empty string is provided #568

Merged
merged 4 commits into from
Aug 20, 2024

Conversation

LouisMPenrod
Copy link
Contributor

Returns a message instead of returning nothing which was the previous behavior. Existing snapshot updated.

Fixes #497

@hadley
Copy link
Member

hadley commented Aug 15, 2024

@DavisVaughan do you remember what we've done when we've printed length-0 objects in other packages?

@DavisVaughan
Copy link
Member

You could use the vctrs approach and always unconditionally print a header

> vctrs::obj_print(1)
<double[1]>
[1] 1
> vctrs::obj_print(double())
<double[0]>

Like <stringr_view[0]> or something. So even in the empty case you get something.


But since this is mostly for interactive usage I don't mind something like No strings provided or something equally friendly. I don't really mind the current behavior much though, it is like glue::glue().

Do we also want to consider the str_view(character(), html = TRUE) case?

@hadley
Copy link
Member

hadley commented Aug 20, 2024

I consider html = TRUE basically superseded so no need to worry about it, I think.

@hadley hadley merged commit 1562054 into tidyverse:main Aug 20, 2024
13 checks passed
@hadley
Copy link
Member

hadley commented Aug 20, 2024

Thanks for working on this and I hope you had fun at TDD 😁

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.

Print something for str_view(character())
3 participants