stringr icon indicating copy to clipboard operation
stringr copied to clipboard

SQL's LIKE is actually case sensitive

Open hadley opened this issue 10 months ago • 4 comments

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()).

hadley avatar Apr 09 '24 20:04 hadley

@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)

edward-burn avatar Apr 10 '24 09:04 edward-burn

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.

hadley avatar Apr 10 '24 13:04 hadley

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

edward-burn avatar Apr 10 '24 20:04 edward-burn

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

hadley avatar May 14 '24 13:05 hadley