Skip to content

Commit 9e03daa

Browse files
hadleycran-robot
authored andcommitted
version 1.5.1
1 parent fa09493 commit 9e03daa

32 files changed

+1588
-1049
lines changed

DESCRIPTION

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
Package: stringr
22
Title: Simple, Consistent Wrappers for Common String Operations
3-
Version: 1.5.0
4-
Authors@R:
5-
c(person(given = "Hadley",
6-
family = "Wickham",
7-
role = c("aut", "cre", "cph"),
8-
email = "[email protected]"),
9-
person(given = "RStudio",
10-
role = c("cph", "fnd")))
3+
Version: 1.5.1
4+
Authors@R: c(
5+
person("Hadley", "Wickham", , "[email protected]", role = c("aut", "cre", "cph")),
6+
person("Posit Software, PBC", role = c("cph", "fnd"))
7+
)
118
Description: A consistent, simple and easy to use set of wrappers around
129
the fantastic 'stringi' package. All function and argument names (and
1310
positions) are consistent, all functions deal with "NA"'s and zero
@@ -17,21 +14,21 @@ License: MIT + file LICENSE
1714
URL: https://stringr.tidyverse.org,
1815
https://github.com/tidyverse/stringr
1916
BugReports: https://github.com/tidyverse/stringr/issues
20-
Depends: R (>= 3.3)
17+
Depends: R (>= 3.6)
2118
Imports: cli, glue (>= 1.6.1), lifecycle (>= 1.0.3), magrittr, rlang
22-
(>= 1.0.0), stringi (>= 1.5.3), vctrs
23-
Suggests: covr, htmltools, htmlwidgets, knitr, rmarkdown, testthat (>=
24-
3.0.0)
19+
(>= 1.0.0), stringi (>= 1.5.3), vctrs (>= 0.4.0)
20+
Suggests: covr, dplyr, gt, htmltools, htmlwidgets, knitr, rmarkdown,
21+
testthat (>= 3.0.0), tibble
2522
VignetteBuilder: knitr
2623
Config/Needs/website: tidyverse/tidytemplate
2724
Config/testthat/edition: 3
2825
Encoding: UTF-8
2926
LazyData: true
30-
RoxygenNote: 7.2.1
27+
RoxygenNote: 7.2.3
3128
NeedsCompilation: no
32-
Packaged: 2022-12-01 20:53:42 UTC; hadleywickham
29+
Packaged: 2023-11-14 15:03:52 UTC; hadleywickham
3330
Author: Hadley Wickham [aut, cre, cph],
34-
RStudio [cph, fnd]
35-
Maintainer: Hadley Wickham <hadley@rstudio.com>
31+
Posit Software, PBC [cph, fnd]
32+
Maintainer: Hadley Wickham <hadley@posit.co>
3633
Repository: CRAN
37-
Date/Publication: 2022-12-02 10:20:02 UTC
34+
Date/Publication: 2023-11-14 23:10:02 UTC

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
YEAR: 2020
1+
YEAR: 2023
22
COPYRIGHT HOLDER: stringr authors

MD5

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
0159d1756152acb395e9896b6a83f1bb *DESCRIPTION
2-
7ade021f2871274e95c9933ddcce8590 *LICENSE
1+
6417661a7c8efb838ad5d5b6f7765ba8 *DESCRIPTION
2+
a0018b1c7c6a9756addc1b079daa5cf0 *LICENSE
33
53cac8267191c7135e60ff422a789b57 *NAMESPACE
4-
d52176f7f5add8347e3faff3f5c5c647 *NEWS.md
4+
3c28871ed9da543fe831761643561104 *NEWS.md
55
11390682e89c2e7653a90d0c72f84241 *R/c.R
66
a4a814af55ec5f84c9c39746ea39edc1 *R/case.R
77
07c06e6be0443b7d5b9094f11daa406f *R/compat-obj-type.R
@@ -10,7 +10,7 @@ f299eacebcf906163a629b2ef7787ba4 *R/compat-types-check.R
1010
236c313428f675772ae78e10ec583aab *R/conv.R
1111
f75b36e8fb84010a555444e6f8950148 *R/count.R
1212
d17b3c3f3f546123603f4f5f84a5f3cb *R/data.R
13-
870050e4bf815ac0cfe5f4aa31cff1a6 *R/detect.R
13+
a864288668850afe6aa376437d70d344 *R/detect.R
1414
02515c6f25da38950c825474b67623e1 *R/dup.R
1515
1c6b2097f903dde0057acb61c89eeb01 *R/equal.R
1616
0df0460a69007695b24bbd4c2bd57645 *R/escape.R
@@ -24,33 +24,33 @@ d072949ee58976ca4e02dcb4e775c394 *R/length.R
2424
815c2c1b410c4e7a5d26fd35f5e097ce *R/modifiers.R
2525
eede1618dad4a0861c54dcdfb2c8ac75 *R/pad.R
2626
d21d0843b2319c6f450c1e62459e2502 *R/remove.R
27-
e19d1dabdde66c74c8696195eec64747 *R/replace.R
27+
100c2b42b967fff29315697c2ef89225 *R/replace.R
2828
dfabd70c0e2d57f9b2c3ce94394a0be5 *R/sort.R
29-
12307cff7d0b02f3803166f797b0362d *R/split.R
29+
0552ae2a46503839a88cfb707866ba80 *R/split.R
3030
89c1a3fe6a9b2c2627c0c217d3240601 *R/stringr-package.R
3131
95a7f7de995ead49e5728f4d5ac9b6af *R/sub.R
32-
d102d46f935d6478c49304ce31ec453a *R/subset.R
32+
9d96b7aeda42bf69cd9b7a1ce5492e3e *R/subset.R
3333
88afe326dd676421d7cc04309610796a *R/trim.R
34-
1c144cd397027b20c0cca2db3a394980 *R/trunc.R
34+
467b44328c4da52de9d4820d84cf9a70 *R/trunc.R
3535
ee836edf224d73d887bc94cf8453705d *R/unique.R
3636
33b05fa3a588a58663f835ce45783e83 *R/utils.R
37-
1aab2340ac7218b978207b4809b9e308 *R/view.R
37+
be25c17f9a9668f766a8a02b73da9268 *R/view.R
3838
9440e9e7a0bbc33ada2e425cf0ed2cbe *R/word.R
3939
ccb9c91317f1b34569c8495f4c8f3b9a *R/wrap.R
40-
560daceab1a99dcd2ff54eb411a21f5f *README.md
41-
587a8ec703725aea800b78dbc43ad728 *build/vignette.rds
40+
0b6dd73d03f405561232bb60c5052c33 *README.md
41+
effdb89ddbda0e944da4a5d7699bbd4b *build/vignette.rds
4242
89f0d280160eb4419b23251639a728c2 *data/fruit.rda
4343
51f821ca3b3f8a286d0ceabccdab6ca7 *data/sentences.rda
4444
c99f00d311e24c76bbeabfc8a58b4b50 *data/words.rda
45-
0717e0dda865628a520b70efe4088ce5 *inst/doc/from-base.R
46-
6a6c3ca43f206912d436d5f2ff53b9f0 *inst/doc/from-base.Rmd
47-
e6910bb5ec8cd1f3b2c165c149317d9b *inst/doc/from-base.html
48-
efc57c3ce213aa9c19f3e1aef8eafd48 *inst/doc/regular-expressions.R
45+
6259b8c4d33f86a18130632a8c44e770 *inst/doc/from-base.R
46+
55fa03361dfbc453024c7ab8df2ede71 *inst/doc/from-base.Rmd
47+
c9b48c49b98c37e75a6f7b64571fd6d6 *inst/doc/from-base.html
48+
13a030b4d1d374db7bc577145b69e24c *inst/doc/regular-expressions.R
4949
bee4d7614ef68fce3dc6772a0442a1ff *inst/doc/regular-expressions.Rmd
50-
db3a77d2a1ab8d55adc08e4a5d368bf6 *inst/doc/regular-expressions.html
51-
1e7c7daf88cc43a474c7fa95bd20e035 *inst/doc/stringr.R
50+
17c9d247135faeb4b172ebc7b47b97e1 *inst/doc/regular-expressions.html
51+
d57838d0deb2a741886f70eeed71604b *inst/doc/stringr.R
5252
2e6abe80c39713fdd5778e6276185408 *inst/doc/stringr.Rmd
53-
316432d18fa01c2b44bb0a827b018e11 *inst/doc/stringr.html
53+
80f1f2e645f232b6fb10cc716a5407f4 *inst/doc/stringr.html
5454
5f38e68c0f6148b954a6849fe553b173 *inst/htmlwidgets/lib/str_view.css
5555
e7c37a495d4ae965400eeb1000dee672 *inst/htmlwidgets/str_view.js
5656
1763429826b7f9745d2e590e4ca4c119 *inst/htmlwidgets/str_view.yaml
@@ -63,14 +63,14 @@ c3978703d8f40f2679795335715e98f4 *man/figures/lifecycle-experimental.svg
6363
27b879bf3677ea76e3991d56ab324081 *man/figures/lifecycle-questioning.svg
6464
53b3f893324260b737b3c46ed2a0e643 *man/figures/lifecycle-stable.svg
6565
1c1fe7a759b86dc6dbcbe7797ab8246c *man/figures/lifecycle-superseded.svg
66-
7090c91ac9cc554962bd49006e492c20 *man/figures/logo.png
66+
86fdd0a3f998a3d5a3ed6a850f5a1a0b *man/figures/logo.png
6767
ab69caa66e7d332f9555f8c4ae39e441 *man/invert_match.Rd
6868
ef8404412dac3596f66f50c3268fd089 *man/modifiers.Rd
6969
a64a7ea44fcaa33c2d3ad0f7909cbc3e *man/pipe.Rd
7070
7ecc8f5ddb1b5fd123cdbf4a532da370 *man/str_c.Rd
7171
4c5363f6872ab4d60fdb91609af1be13 *man/str_conv.Rd
7272
d6973b6218a2a1a32eee03e1a0ffa41c *man/str_count.Rd
73-
1000966cf57fea2444b607ccc2af544a *man/str_detect.Rd
73+
1bdaa07efcfb600dadd5a93342af1e4b *man/str_detect.Rd
7474
b07cca29357daa5c72bad16c916ede42 *man/str_dup.Rd
7575
5f09e863013a8297b0b38ffa1d3ba5fe *man/str_equal.Rd
7676
0e95910de21db06a6e642bbd8cc17e96 *man/str_escape.Rd
@@ -85,20 +85,20 @@ c78d29b9b7696ac56fbd4f8975efa955 *man/str_match.Rd
8585
6ac9678ff6aa4a96ff3beb460a2d565e *man/str_order.Rd
8686
df526bd928ec6a89b62d80df016d7aa9 *man/str_pad.Rd
8787
ae9a5667a4064d65c3812080b3f80fec *man/str_remove.Rd
88-
971fd857c152ec3e1a614a170429cd99 *man/str_replace.Rd
88+
94e9edf26c8bdca90bcac40e426ba042 *man/str_replace.Rd
8989
797da58fc306dc7b018434727a32d26a *man/str_replace_na.Rd
90-
6e63a8cbef658f157deaf11c23ede89c *man/str_split.Rd
91-
4e583cc81b73318e6a9b112a09ad5de4 *man/str_starts.Rd
90+
fffbbf8d258f6be66101c63210570936 *man/str_split.Rd
91+
422188a7f648f1047e529fcafa3dcacc *man/str_starts.Rd
9292
a0bda4a83f1bbcce75d6ff072eab3812 *man/str_sub.Rd
93-
ce0cbf4621404b60aa2d2581e2dbf139 *man/str_subset.Rd
93+
d92d29fbb86b0fb2a98e496af68e5561 *man/str_subset.Rd
9494
7dffcd7bcfda40c125dd8da67404a32e *man/str_trim.Rd
9595
4e4e96af2d85d1f024a8c3495c7a8400 *man/str_trunc.Rd
9696
ad920b9d524a6cdad804abddd67836bc *man/str_unique.Rd
97-
9faf577778226aaa3442aaafb319530a *man/str_view.Rd
98-
8efd19a04b89baffbb62def75fb1eca9 *man/str_which.Rd
97+
fce68051479e8c8a2126cab061cc956a *man/str_view.Rd
98+
6f3edc14ec4040eaa8414f53ead6e9d9 *man/str_which.Rd
9999
fb432c6d1ee6a45f6bae4630a72e4c31 *man/str_wrap.Rd
100100
b020a9e0c22c8a73988673d8105e6beb *man/stringr-data.Rd
101-
ad9adae34f89601e6526e23869240022 *man/stringr-package.Rd
101+
faadd8ce234ceadf5aa02978b567398f *man/stringr-package.Rd
102102
0e38c8016c39ab1cbfdac436864918df *man/word.Rd
103103
4ee9d05bd4688270eca8d85299cedcd1 *tests/testthat.R
104104
2495853cc152148a9967b97a742189d2 *tests/testthat/_snaps/c.md
@@ -109,7 +109,7 @@ bb5aa361c47349d8e72ef050f17ce13f *tests/testthat/_snaps/modifiers.md
109109
f7d84d80aac766e0dabc941f4d1cc99f *tests/testthat/_snaps/split.md
110110
b226cf3dc38f2430e39bcdace6baa41f *tests/testthat/_snaps/subset.md
111111
998a7db85bac398d9ad63edc24ae9fb4 *tests/testthat/_snaps/trunc.md
112-
1b89aa59b6c6b45c8cb6c0d44bddaa89 *tests/testthat/_snaps/view.md
112+
666ca9c4c0f885d6829fadce41a61616 *tests/testthat/_snaps/view.md
113113
04fa3430820d49de179ce1be247461bf *tests/testthat/test-c.R
114114
1b96097e258ae55b2501a037dfb9005f *tests/testthat/test-case.R
115115
cbf33254fcbdb2f01825365e017d5ee4 *tests/testthat/test-conv.R
@@ -134,11 +134,11 @@ fe205e7026398ab262c3d9bbcc94579e *tests/testthat/test-match.R
134134
2399869fcfc88342844800f634459d2a *tests/testthat/test-sub.R
135135
968816a52cce5608b6159e758526739d *tests/testthat/test-subset.R
136136
d6bcfb2fd01012d8ec733a7600291bed *tests/testthat/test-trim.R
137-
4097523b4d06c58e38f3b4499e3cfdc6 *tests/testthat/test-trunc.R
137+
bf32022e418f7e355da993ba8b354600 *tests/testthat/test-trunc.R
138138
c801dfc65d41c161b000ea64a49f6944 *tests/testthat/test-unique.R
139-
a4c2ac83595742fc4e54644df086f4b9 *tests/testthat/test-view.R
139+
8a43c5c965ddfc1680a58812acde8267 *tests/testthat/test-view.R
140140
a1de73cbd092c5c94bf6a51e6103740c *tests/testthat/test-word.R
141141
217ae1d7e7fa11dcf0b5ba0ed1c08473 *tests/testthat/test-wrap.R
142-
6a6c3ca43f206912d436d5f2ff53b9f0 *vignettes/from-base.Rmd
142+
55fa03361dfbc453024c7ab8df2ede71 *vignettes/from-base.Rmd
143143
bee4d7614ef68fce3dc6772a0442a1ff *vignettes/regular-expressions.Rmd
144144
2e6abe80c39713fdd5778e6276185408 *vignettes/stringr.Rmd

NEWS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# stringr 1.5.1
2+
3+
* Some minor documentation improvements.
4+
5+
* `str_trunc()` now correctly truncates strings when `side` is `"left"` or
6+
`"center"` (@UchidaMizuki, #512).
7+
18
# stringr 1.5.0
29

310
## Breaking changes

R/detect.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#' [boundary()]. An empty pattern, "", is equivalent to
2222
#' `boundary("character")`.
2323
#'
24-
#' @param negate If `TRUE`, return non-matching elements.
24+
#' @param negate If `TRUE`, inverts the resulting boolean vector.
2525
#' @return A logical vector the same length as `string`/`pattern`.
2626
#' @seealso [stringi::stri_detect()] which this function wraps,
2727
#' [str_subset()] for a convenient wrapper around

R/replace.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
#' in [stringi::about_search_regex]. Control options with
1111
#' [regex()].
1212
#'
13-
#' To perform multiple replacements in each element of `string`,
14-
#' pass supply a named vector (`c(pattern1 = replacement1)`).
13+
#' For `str_replace_all()` this can also be a named vector
14+
#' (`c(pattern1 = replacement1)`), in order to perform multiple replacements
15+
#' in each element of `string`.
1516
#'
1617
#' Match a fixed string (i.e. by comparing only bytes), using
1718
#' [fixed()]. This is fast, but approximate. Generally,

R/split.R

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
#' Split up a string into pieces
22
#'
33
#' @description
4-
#' These functions differ primarily in their input and output types:
4+
#' This family of functions provides various ways of splitting a string up
5+
#' into pieces. These two functions return a character vector:
56
#'
6-
#' * `str_split()` takes a character vector and returns a list.
7-
#' * `str_split_1()` takes a single string and returns a character vector.
8-
#' * `str_split_fixed()` takes a character vector and returns a matrix.
9-
#' * `str_split_i()` takes a character vector and returns a character
10-
#' vector.
7+
#' * `str_split_1()` takes a single string and splits it into pieces,
8+
#' returning a single character vector.
9+
#' * `str_split_i()` splits each string in a character vector into pieces and
10+
#' extracts the `i`th value, returning a character vector.
11+
#'
12+
#' These two functions return a more complex object:
13+
#'
14+
#' * `str_split()` splits each string in a character vector into a varying
15+
#' number of pieces, returning a list of character vectors.
16+
#' * `str_split_fixed()` splits each string in a character vector into a
17+
#' fixed number of pieces, returning a character matrix.
1118
#'
1219
#' @inheritParams str_detect
1320
#' @inheritParams str_extract
1421
#' @param n Maximum number of pieces to return. Default (Inf) uses all
1522
#' possible split positions.
1623
#'
17-
#' For `split_split()`, this determines the maximum length of each element
24+
#' For `str_split()`, this determines the maximum length of each element
1825
#' of the output. For `str_split_fixed()`, this determines the number of
1926
#' columns in the output; if an input is too short, the result will be padded
2027
#' with `""`.
@@ -36,7 +43,7 @@
3643
#' str_split(fruits, " and ")
3744
#' str_split(fruits, " and ", simplify = TRUE)
3845
#'
39-
#' # If you want to split a single string, use `str_split1`
46+
#' # If you want to split a single string, use `str_split_1`
4047
#' str_split_1(fruits[[1]], " and ")
4148
#'
4249
#' # Specify n to restrict the number of possible matches

R/subset.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ str_subset <- function(string, pattern, negate = FALSE) {
4141

4242
#' Find matching indices
4343
#'
44-
#' `str_subset()` returns the indices of`string` where there's at least
44+
#' `str_which()` returns the indices of `string` where there's at least
4545
#' one match to `pattern`. It's a wrapper around
4646
#' `which(str_detect(x, pattern))`, and is equivalent to `grep(pattern, x)`.
4747
#'

R/trunc.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ str_trunc <- function(string, width, side = c("right", "left", "center"),
2323
side <- arg_match(side)
2424
check_string(ellipsis)
2525

26-
too_long <- !is.na(string) & str_length(string) > width
26+
len <- str_length(string)
27+
too_long <- !is.na(string) & len > width
2728
width... <- width - str_length(ellipsis)
2829

2930
if (width... < 0) {
@@ -34,11 +35,11 @@ str_trunc <- function(string, width, side = c("right", "left", "center"),
3435

3536
string[too_long] <- switch(side,
3637
right = str_c(str_sub(string[too_long], 1, width...), ellipsis),
37-
left = str_c(ellipsis, str_sub(string[too_long], -width..., -1)),
38+
left = str_c(ellipsis, str_sub(string[too_long], len[too_long] - width... + 1, -1)),
3839
center = str_c(
3940
str_sub(string[too_long], 1, ceiling(width... / 2)),
4041
ellipsis,
41-
str_sub(string[too_long], -floor(width... / 2), -1)
42+
str_sub(string[too_long], len[too_long] - floor(width... / 2) + 1, -1)
4243
)
4344
)
4445
string

R/view.R

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
#'
1818
#' If `pattern` is not supplied, all elements are always shown.
1919
#' @param html Use HTML output? If `TRUE` will create an HTML widget; if `FALSE`
20-
#' will style using ANSI escapes. The default prefers ANSI escapes if
21-
#' available in the current terminal; you can override by setting
22-
#' `options(stringr.html = TRUE)`.
20+
#' will style using ANSI escapes.
2321
#' @param use_escapes If `TRUE`, all non-ASCII characters will be rendered
2422
#' with unicode escapes. This is useful to see exactly what underlying
2523
#' values are stored in the string.
@@ -80,7 +78,7 @@ str_view <- function(string, pattern = NULL, match = TRUE, html = FALSE, use_esc
8078
#' @usage NULL
8179
#' @export
8280
str_view_all <- function(string, pattern = NULL, match = NA, html = FALSE, use_escapes = FALSE) {
83-
lifecycle::deprecate_warn("1.5.0", "str_view()", "str_view_all()")
81+
lifecycle::deprecate_warn("1.5.0", "str_view_all()", "str_view()")
8482

8583
str_view(
8684
string = string,

0 commit comments

Comments
 (0)