Skip to content

Commit

Permalink
refactor!: the ascii_case_insensitive argument must be named in `$s…
Browse files Browse the repository at this point in the history
…tr$contains_any()` (#986)

Co-authored-by: Etienne Bacher <52219252+etiennebacher@users.noreply.github.com>
  • Loading branch information
eitsupi and etiennebacher committed Mar 30, 2024
1 parent b3cb553 commit dea03d5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
- Removed `<Series>$to_r_vector()` which was an old alias for
`<Series>$to_vector()` (#938).
- In `$str$contains()`, the arguments `literal` and `strict` should be named arguments (#982).
- In `$str$contains_any()`, the `ascii_case_insensitive` argument must be named (#986).
- In `$str$strptime()`, `$str$to_date()`, `$str$to_datetime()`, and
`$str$to_time()`, all arguments (except the first one) must be named (#939).
- In `$str$strptime()`, the argument `datatype` is renamed `dtype` (#939).
Expand Down
11 changes: 6 additions & 5 deletions R/expr__string.R
Original file line number Diff line number Diff line change
Expand Up @@ -874,13 +874,14 @@ ExprStr_reverse = function() {
#' Use the aho-corasick algorithm to find matches
#'
#' This function determines if any of the patterns find a match.
#' @param patterns String patterns to search. Can be an Expr.
#' @inherit ExprStr_contains params return
#' @param patterns Character vector or something can be coerced to strings [Expr][Expr_class]
#' of a valid regex pattern, compatible with the [regex crate](https://docs.rs/regex/latest/regex/).
#' @param ascii_case_insensitive Enable ASCII-aware case insensitive matching.
#' When this option is enabled, searching will be performed without respect to
#' case for ASCII letters (a-z and A-Z) only.
#'
#' @return Expr
#'
#' @seealso
#' - [`<Expr>$str$contains()`][ExprStr_contains]
#' @examples
#' df = pl$DataFrame(
#' lyrics = c(
Expand All @@ -893,7 +894,7 @@ ExprStr_reverse = function() {
#' df$with_columns(
#' contains_any = pl$col("lyrics")$str$contains_any(c("you", "me"))
#' )
ExprStr_contains_any = function(patterns, ascii_case_insensitive = FALSE) {
ExprStr_contains_any = function(patterns, ..., ascii_case_insensitive = FALSE) {
.pr$Expr$str_contains_any(self, patterns, ascii_case_insensitive) |>
unwrap("in str$contains_any():")
}
Expand Down
14 changes: 11 additions & 3 deletions man/ExprStr_contains_any.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dea03d5

Please sign in to comment.