|
4 | 4 | #' how duplication is measured. |
5 | 5 | #' |
6 | 6 | #' @inheritParams str_detect |
7 | | -#' @param ... Other options used to control matching behavior between duplicate |
8 | | -#' strings. Passed on to [stringi::stri_opts_collator()]. |
| 7 | +#' @inheritParams str_equal |
9 | 8 | #' @return A character vector, usually shorter than `string`. |
10 | 9 | #' @seealso [unique()], [stringi::stri_unique()] which this function wraps. |
11 | 10 | #' @examples |
12 | 11 | #' str_unique(c("a", "b", "c", "b", "a")) |
13 | 12 | #' |
| 13 | +#' str_unique(c("a", "b", "c", "B", "A")) |
| 14 | +#' str_unique(c("a", "b", "c", "B", "A"), ignore_case = TRUE) |
| 15 | +#' |
14 | 16 | #' # Use ... to pass additional arguments to stri_unique() |
15 | 17 | #' str_unique(c("motley", "mötley", "pinguino", "pingüino")) |
16 | 18 | #' str_unique(c("motley", "mötley", "pinguino", "pingüino"), strength = 1) |
17 | 19 | #' @export |
18 | | -str_unique <- function(string, ...) { |
19 | | - stri_unique(string, opts_collator = stri_opts_collator(...)) |
| 20 | +str_unique <- function(string, locale = "en", ignore_case = FALSE, ...) { |
| 21 | + check_string(locale) |
| 22 | + check_bool(ignore_case) |
| 23 | + |
| 24 | + opts <- str_opts_collator( |
| 25 | + locale = locale, |
| 26 | + ignore_case = ignore_case, |
| 27 | + ... |
| 28 | + ) |
| 29 | + stri_unique(string, opts_collator = opts) |
20 | 30 | } |
0 commit comments