Skip to content

Conversation

@hadley
Copy link
Member

@hadley hadley commented Oct 27, 2025

No description provided.


Second, if you use [`str_replace_all()`](https://stringr.tidyverse.org/reference/str_replace.html) with a function for the `replacement` argument, that function now receives all values in a single character vector instead of being called once per string. This change dramatically improves performance, so I decided this change was worth it despite its impact on existing code. I don't think this should affect too much existing code, since it's only affected 9 of the 2,381 packages that use stringr (which I supplied PRs to fix). If your replacement function was designed to work on individual strings, you'll need to vectorise it.

If you haven't used this functionality before, it's pretty cool, because it allows you to supply a function that can transform matches in any way you can imagine. For example, this code that color names with their corresponding hex values:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If you haven't used this functionality before, it's pretty cool, because it allows you to supply a function that can transform matches in any way you can imagine. For example, this code that color names with their corresponding hex values:
If you haven't used this functionality before, it's pretty cool, because it allows you to supply a function that can transform matches in any way you can imagine. For example, this code replaces colour names with their corresponding hex values:

`str_replace_all()` for function replacements. It also introduces `str_ilike()`
for case-insensitive SQL-like pattern matching, three new case conversion
functions (`str_to_camel()`, `str_to_snake()`, and `str_to_kebab()`), and
presrves names in all relevant functions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
presrves names in all relevant functions.
preserves names in all relevant functions.

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

Successfully merging this pull request may close these issues.

4 participants