Consider adding a parameter to make `vec_match()` and `vec_in()` case insensitive
arnaudgallou opened this issue · comments
Arnaud Gallou commented
It's fairly common to want to match values independently from the case. Although it's easy to lower case the input data, having a parameter to do it would make it even easier and reduce cognitive load.
# tends to be easier to read
vec_match(needles, haystack, ignore_case = TRUE)
# than
vec_match(tolower(needles), tolower(haystack))
Davis Vaughan commented
Thanks, but I think in this case it is better to keep vec_match()
and vec_in()
as generic as possible, and let other helpers like tolower()
take care of normalizing the input if that is required.