You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I assume there's a good reason why this seems not to have been done. However, I can't see it and think it would make it easier for people used to base regex to switch. str_which() could be a good option. Could put in a PR but wanted to check if this is something that would be useful.
Why do you want indices though? I think it's usually a mistake to want them, and in general, you're better off making it explicit by using which (although str_which() might possible be a good name)
Just for ease of use on the UI - many people discover grep() before they discover grepl() (based on my own experience and teaching). So I think a drop-in replacement would be used, especially by beginners. Just a use-ability thing and totally agree non indexed version is generally better.
Activity
hadley commentedon Dec 30, 2016
Why do you want indices though? I think it's usually a mistake to want them, and in general, you're better off making it explicit by using
which(althoughstr_which()might possible be a good name)hadley commentedon Dec 30, 2016
@gagolews there's no existing equivalent of this in stringi, right?
Robinlovelace commentedon Dec 30, 2016
Just for ease of use on the UI - many people discover
grep()before they discovergrepl()(based on my own experience and teaching). So I think a drop-in replacement would be used, especially by beginners. Just a use-ability thing and totally agree non indexed version is generally better.gagolews commentedon Dec 30, 2016
@hadley it's on a to-do list, gagolews/stringi#90
Robinlovelace commentedon Jan 3, 2017
Thanks!