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

SQL's LIKE is actually case sensitive #543

Open
hadley opened this issue Apr 9, 2024 · 4 comments
Open

SQL's LIKE is actually case sensitive #543

hadley opened this issue Apr 9, 2024 · 4 comments

Comments

@hadley
Copy link
Member

hadley commented Apr 9, 2024

So need to change the default, and update the docs.

Probably worth a little exploration of impact on users (with github search for str_like()).

@edward-burn
Copy link

@hadley I wonder whether instead of changing the default of ignore_case, what about introducing a new function: str_ilike()?

Then stringr could have two functions

  • str_like - similar to SQL LIKE that is case sensitive
  • str_ilike - similar to SQL ILIKE that is case insensitive

I suppose the benefit of this would be that these would more directly align with SQL concepts. But the drawback would be this would be a bigger change (although perhaps a less subtle breaking change than simply switching the default)

@hadley
Copy link
Member Author

hadley commented Apr 10, 2024

Yeah, I think that's a good idea. Then we can just deprecate the ignore_case argument.

OTOH it's not very consistent with how other stringr handle case. But I think it's justifiable in this case because it's so closely related to mimicing SQL.

edward-burn added a commit to edward-burn/stringr that referenced this issue Apr 10, 2024
- add str_ilike function
- remove ignore_case argument from str_like
- add tests of case sensitivity for both
@edward-burn
Copy link

@hadley I have opened pr #544 with a str_ilike function and the ignore_case argument in str_like deprecated

@hadley
Copy link
Member Author

hadley commented May 14, 2024

Thanks, I'll take a look when I'm next working on stringr.

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

No branches or pull requests

2 participants