Skip to content

Commit

Permalink
Fix documentation that implies pattern argument can be empty
Browse files Browse the repository at this point in the history
  • Loading branch information
wright13 committed Aug 15, 2024
1 parent 8816213 commit 330d100
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 21 deletions.
14 changes: 14 additions & 0 deletions R/count.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
#' of `string.`
#'
#' @inheritParams str_detect
#' @param pattern Pattern to look for.
#'
#' The default interpretation is a regular expression, as described in
#' `vignette("regular-expressions")`. Use [regex()] for finer control of the
#' matching behaviour.
#'
#' Match a fixed string (i.e. by comparing only bytes), using
#' [fixed()]. This is fast, but approximate. Generally,
#' for matching human text, you'll want [coll()] which
#' respects character matching rules for the specified locale.
#'
#' Match character, word, line and sentence boundaries with
#' [boundary()]. An empty pattern, "", is equivalent to
#' `boundary("character")`.
#' @return An integer vector the same length as `string`/`pattern`.
#' @seealso [stringi::stri_count()] which this function wraps.
#'
Expand Down
5 changes: 2 additions & 3 deletions R/detect.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
#' for matching human text, you'll want [coll()] which
#' respects character matching rules for the specified locale.
#'
#' Match character, word, line and sentence boundaries with
#' [boundary()]. An empty pattern, "", is equivalent to
#' `boundary("character")`.
#' Pattern cannot be a character, word, line, or sentence boundary. An empty
#' pattern, "", is equivalent to `boundary("character")`.
#'
#' @param negate If `TRUE`, inverts the resulting boolean vector.
#' @return A logical vector the same length as `string`/`pattern`.
Expand Down
2 changes: 1 addition & 1 deletion R/extract.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' `str_extract()` extracts the first complete match from each string,
#' `str_extract_all()`extracts all matches from each string.
#'
#' @inheritParams str_detect
#' @inheritParams str_count
#' @param group If supplied, instead of returning the complete match, will
#' return the matched text from the specified capturing group.
#' @seealso [str_match()] to extract matched groups;
Expand Down
2 changes: 1 addition & 1 deletion R/locate.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#' Because the `start` and `end` values are inclusive, zero-length matches
#' (e.g. `$`, `^`, `\\b`) will have an `end` that is smaller than `start`.
#'
#' @inheritParams str_detect
#' @inheritParams str_count
#' @returns
#' * `str_locate()` returns an integer matrix with two columns and
#' one row for each element of `string`. The first column, `start`,
Expand Down
1 change: 0 additions & 1 deletion R/split.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#' * `str_split_fixed()` splits each string in a character vector into a
#' fixed number of pieces, returning a character matrix.
#'
#' @inheritParams str_detect
#' @inheritParams str_extract
#' @param n Maximum number of pieces to return. Default (Inf) uses all
#' possible split positions.
Expand Down
5 changes: 2 additions & 3 deletions man/str_detect.Rd

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

5 changes: 2 additions & 3 deletions man/str_remove.Rd

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

5 changes: 2 additions & 3 deletions man/str_subset.Rd

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

5 changes: 2 additions & 3 deletions man/str_view.Rd

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

5 changes: 2 additions & 3 deletions man/str_which.Rd

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

0 comments on commit 330d100

Please sign in to comment.