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

Empty template {} returns character(0) output #157

Closed
mmuurr opened this issue Dec 13, 2019 · 1 comment
Closed

Empty template {} returns character(0) output #157

mmuurr opened this issue Dec 13, 2019 · 1 comment

Comments

@mmuurr
Copy link

mmuurr commented Dec 13, 2019

Is the behavior below expected?
I ran into a unique situation recently where the template itself has an empty splice region ({}), leading to an empty vector as a result:

str(glue::glue("{}{1+1}"))
#>  'glue' chr(0)

In the above example, I think(?) most would expect something like this as output:

str(glue::glue("{1+1}"))
#>  'glue' chr "2"

... but perhaps this is intentional?

@jimhester
Copy link
Collaborator

Yes it is intentional, {} produces NULL, and the principle glue follows is 0 length inputs should generate 0 length outputs.

see #100, #84 for additional issues related to this.

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