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

Unexpected behavior of str_trunc #203

Closed
guiastrennec opened this issue Dec 29, 2017 · 0 comments
Closed

Unexpected behavior of str_trunc #203

guiastrennec opened this issue Dec 29, 2017 · 0 comments

Comments

@guiastrennec
Copy link

@guiastrennec guiastrennec commented Dec 29, 2017

I encountered an unexpected behavior of str_trunc(), here is a reprex of my problem.

In stringr v1.2.0 the result is as expected:

str_trunc(c('abcd', 'abcde', 'abcdef'), width = 5)
[1] "abcd"  "abcde" "ab..."

In stringr v1.2.0.9000 the result not what one would unexpect:

str_trunc(c('abcd', 'abcde', 'abcdef'), width = 5)
[1] "abcd"   "abcde"  "abcdef"

And changing the order of the elements of the vector also impacts the output, which leads me to believe that the truncation is performed or not based on the number of characters in the first element of the vector of strings

str_trunc(c('abcdef', 'abcde', 'abcd'), width = 5)
[1] "ab..." "ab..." "ab..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

1 participant