Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennebacher committed Mar 30, 2024
1 parent 4fc496b commit 96d8fb9
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 16 deletions.
34 changes: 23 additions & 11 deletions R/expr__string.R
Original file line number Diff line number Diff line change
Expand Up @@ -429,24 +429,31 @@ ExprStr_pad_start = function(width, fillchar = " ") {
}


# TODO: Add ExprStr_find to seealso
#' Check if string contains a substring that matches a pattern
#'
#' @details To modify regular expression behaviour (such as case-sensitivity) with flags,
#' use the inline `(?iLmsuxU)` syntax. See the regex crate’s section on
#' [grouping and flags](https://docs.rs/regex/latest/regex/#grouping-and-flags)
#' for additional information about the use of inline expression modifiers.
#' @param pattern A character or something can be coerced to a string [Expr][Expr_class]
#' of a valid regex pattern, compatible with the [regex crate](https://docs.rs/regex/latest/regex/).
#' @param ... Ignored.
#' @param literal Logical. If `TRUE` (default), treat `pattern` as a literal string,
#' not as a regular expression.
#' @param strict Logical. If `TRUE` (default), raise an error if the underlying pattern is
#' not a valid regex, otherwise mask out with a null value.
#'
#' @details To modify regular expression behaviour (such as case-sensitivity)
#' with flags, use the inline `(?iLmsuxU)` syntax. See the regex crate’s section
#' on [grouping and flags](https://docs.rs/regex/latest/regex/#grouping-and-flags)
#' for additional information about the use of inline expression modifiers.
#'
#' @return [Expr][Expr_class] of Boolean data type
#' @seealso
#' - [`<Expr>$str$start_with()`][ExprStr_starts_with]: Check if string values start with a substring.
#' - [`<Expr>$str$ends_with()`][ExprStr_ends_with]: Check if string values end with a substring.
#' - [`$str$start_with()`][ExprStr_starts_with]: Check if string values
#' start with a substring.
#' - [`$str$ends_with()`][ExprStr_ends_with]: Check if string values end
#' with a substring.
#' - [`$str$find()`][ExprStr_find]: Return the index position of the first
#' substring matching a pattern.
#'
#'
#' @examples
#' # The inline `(?i)` syntax example
#' pl$DataFrame(s = c("AAA", "aAa", "aaa"))$with_columns(
Expand Down Expand Up @@ -969,13 +976,18 @@ ExprStr_extract_groups = function(pattern) {

#' Return the index position of the first substring matching a pattern
#'
#' @inheritParams ExprStr_count_matches
#' @param ... Not used.
#' @param strict Raise an error if the underlying pattern is not a valid regex,
#' otherwise mask out with a null value.
#' @inheritParams ExprStr_contains
#'
#' @return An Expr of data type UInt32
#'
#' @seealso
#' - [`$str$start_with()`][ExprStr_starts_with]: Check if string values
#' start with a substring.
#' - [`$str$ends_with()`][ExprStr_ends_with]: Check if string values end
#' with a substring.
#' - [`$str$contains()`][ExprStr_contains]: Check if string contains a substring
#' that matches a pattern.
#'
#' @examples
#' pl$DataFrame(s = c("AAA", "aAa", "aaa"))$with_columns(
#' default_match = pl$col("s")$str$find("Aa"),
Expand Down
14 changes: 9 additions & 5 deletions man/ExprStr_contains.Rd

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

42 changes: 42 additions & 0 deletions man/ExprStr_find.Rd

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

0 comments on commit 96d8fb9

Please sign in to comment.