-
Notifications
You must be signed in to change notification settings - Fork 192
Closed
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviorwipwork in progresswork in progress
Description
For example
> sapply(3:1, function(x) str_trunc("blahblahblah", x))
[1] "..." "blahblahblah..." "blahblahbla..."
> sapply(5:1, function(x) str_trunc("blahblahblah", x))
[1] "bl..." "b..." "..." "blahblahblah..." "blahblahbla..."
> sapply(5:1, function(x) str_trunc("blahblahblah", x, side = "left"))
[1] "...ah" "...h" "...blahblahblah" "...blahblahblah" "...lahblahblah"
> sapply(5:1, function(x) str_trunc("blahblahblah", x, side = "center"))
[1] "b...h" "b...blahblahblah" "...blahblahblah" "...blahblahblah"
[5] "blahblahblah...blahblahblah"
> sapply(5:1, function(x) str_trunc("blahblahblah", x, ellipsis = ".."))
[1] "bla.." "bl.." "b.." ".." "blahblahblah.."
> sapply(5:1, function(x) str_trunc("blahblahblah", x, ellipsis = "...."))
[1] "b...." "...." "blahblahblah...." "blahblahbla...." "blahblahbl...."
I'm not sure what should happen when width < str_length(elipsis)
(warning? error? NA?), but making the string longer can't be right.
Session Info
> devtools::session_info()
Session info ----------------------------------------------------------------------------------------------------------------------------
setting value
version R version 3.4.0 (2017-04-21)
system x86_64, linux-gnu
ui RStudio (1.0.143)
language (EN)
collate en_US.UTF-8
tz America/New_York
date 2017-05-09
Packages --------------------------------------------------------------------------------------------------------------------------------
package * version date source
devtools 1.12.0 2016-12-05 CRAN (R 3.4.0)
digest 0.6.12 2017-01-27 CRAN (R 3.4.0)
magrittr * 1.5 2014-11-22 CRAN (R 3.4.0)
memoise 1.1.0 2017-04-21 CRAN (R 3.4.0)
stringi 1.1.5 2017-04-07 CRAN (R 3.4.0)
stringr * 1.2.0 2017-02-18 CRAN (R 3.4.0)
withr 1.0.2 2016-06-20 CRAN (R 3.4.0)
(not dev, but this function hasn't changed in awhile)
Metadata
Metadata
Assignees
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviorwipwork in progresswork in progress