|
3 | 3 | ## Breaking changes |
4 | 4 |
|
5 | 5 | * stringr functions now consistently implement the tidyverse recycling rules |
6 | | - (#372). Overall this is a fairly minor change as stringi was already very |
7 | | - close to the tidyverse rules. There are only two major changes: |
| 6 | + (#372). There are two main changes: |
8 | 7 |
|
9 | | - * Only vectors of length 1 are recycled: previously, |
10 | | - (e.g.) `str_detect(letters, c("x", "y"))` worked, but it now errors. |
| 8 | + * Only vectors of length 1 are recycled. Previously, (e.g.) |
| 9 | + `str_detect(letters, c("x", "y"))` worked, but it now errors. |
11 | 10 |
|
12 | 11 | * `str_c()` ignores `NULLs`, rather than treating them as length 0 |
13 | 12 | vectors. |
|
20 | 19 | * `str_detect()`, `str_starts()`, `str_ends()` and `str_subset()` now error |
21 | 20 | when used with either an empty string (`""`) or a `boundary()`. These |
22 | 21 | operations didn't really make sense (`str_detect(x, "")` returned `TRUE` |
23 | | - for all non-empty strings) and made it easy to make mistakes when programming |
24 | | - with patterns. |
| 22 | + for all non-empty strings) and made it easy to make mistakes when programming. |
25 | 23 |
|
26 | 24 | ## New features |
27 | 25 |
|
28 | 26 | * Many tweaks to the documentation to make it more useful and consistent. |
29 | 27 |
|
30 | | -* `str_view()` will use ANSI colouring if available (#370). This works in more |
31 | | - places than HTML widgets and requires fewer dependencies. `str_view()` also |
32 | | - no longer requires a pattern so you can use it to display strings with |
33 | | - special characters. It now highlights whitespace characters apart from space |
34 | | - since otherwise they are often confusing. It's also now vectorised over both |
35 | | - `string` and `pattern` (#407). It defaults to displaying all matches, making |
36 | | - `str_view_all()` redundant (and hence deprecated) (#455). |
37 | | - |
38 | 28 | * New `vignette("from-base")` by @sastoudt provides a comprehensive comparison |
39 | 29 | between base R functions and their stringr equivalents. It's designed to |
40 | 30 | help you move to stringr if you're already familiar with base R string |
41 | 31 | functions (#266). |
42 | 32 |
|
43 | 33 | * New `str_escape()` escapes regular expression metacharacters, providing |
44 | | - an alternative to `fixed()` if you want to compose a pattern from external |
45 | | - strings (#408). |
| 34 | + an alternative to `fixed()` if you want to compose a pattern from user |
| 35 | + supplied strings (#408). |
46 | 36 |
|
47 | 37 | * New `str_equal()` compares two character vectors using unicode rules, |
48 | | - and optionally ignores case (#381). |
| 38 | + optionally ignoring case (#381). |
49 | 39 |
|
50 | 40 | * `str_extract()` can now optionally extract a capturing group instead of |
51 | 41 | the complete match (#420). |
52 | 42 |
|
53 | | -* `str_flatten_comma()` is a special case of `str_flatten()` designed for |
54 | | - comman separated flattening and can handle the special case of Oxford |
55 | | - commas with two elements (#444). |
| 43 | +* New `str_flatten_comma()` is a special case of `str_flatten()` designed for |
| 44 | + comma separated flattening and can correctly apply the Oxford commas |
| 45 | + when there are only two elements (#444). |
56 | 46 |
|
57 | 47 | * New `str_split_1()` is tailored for the special case of splitting up a single |
58 | 48 | string (#409). |
59 | 49 |
|
60 | | -* New `str_split_i()` function to extract only a single piece from a string |
61 | | - (#278, @bfgray3). |
| 50 | +* New `str_split_i()` extract a single piece from a string (#278, @bfgray3). |
62 | 51 |
|
63 | | -* New `str_like()` function which allows the use of SQL wildcards |
64 | | - (#280, @rjpat). |
| 52 | +* New `str_like()` allows the use of SQL wildcards (#280, @rjpat). |
65 | 53 |
|
66 | | -* New `str_rank()` to complete set of order/rank/sort functions (#353). |
| 54 | +* New `str_rank()` to complete the set of order/rank/sort functions (#353). |
67 | 55 |
|
68 | 56 | * New `str_sub_all()` to extract multiple substrings from each string. |
69 | 57 |
|
70 | 58 | * New `str_unique()` is a wrapper around `stri_unique()` and returns unique |
71 | 59 | string values in a character vector (#249, @seasmith). |
72 | 60 |
|
| 61 | +* `str_view()` uses ANSI colouring rather than an HTML widget (#370). This |
| 62 | + works in more places and requires fewer dependencies. It includes a number |
| 63 | + of other small improvements: |
| 64 | + |
| 65 | + * It no longer requires a pattern so you can use it to display strings with |
| 66 | + special characters. |
| 67 | + * It highlights unusual whitespace characters. |
| 68 | + * It's vectorised over both string` and `pattern` (#407). |
| 69 | + * It defaults to displaying all matches, making `str_view_all()` redundant |
| 70 | + (and hence deprecated) (#455). |
| 71 | + |
73 | 72 | * New `str_width()` returns the display width of a string (#380). |
74 | 73 |
|
75 | 74 | * stringr is now licensed as MIT (#351). |
|
87 | 86 | final separator (#377). It gains a `na.rm` argument to remove missing |
88 | 87 | values (since it's a summary function) (#439). |
89 | 88 |
|
90 | | -* `str_pad()` gains `use_width` argument to control whether to use the total code |
91 | | - point width or the number of code points as "width" of a string (#190). |
| 89 | +* `str_pad()` gains `use_width` argument to control whether to use the total |
| 90 | + code point width or the number of code points as "width" of a string (#190). |
92 | 91 |
|
93 | 92 | * `str_replace()` and `str_replace_all()` can use standard tidyverse formula |
94 | 93 | shorthand for `replacement` function (#331). |
|
0 commit comments