stringi (version 0.2-5)

stri_replace_all_coll: Replace Occurrences of a Canonically Equivalent Pattern Matches

Description

Replaces with the given replacement string every/first/last substring of the input that matches the pattern.

Usage

stri_replace_all_coll(str, pattern, replacement, opts_collator = NULL)

stri_replace_first_coll(str, pattern, replacement, opts_collator = NULL)

stri_replace_last_coll(str, pattern, replacement, opts_collator = NULL)

Arguments

str
character vector of strings to search in
pattern
character vector of patterns to search for
replacement
character vector of strings to replace with
opts_collator
a named list with ICU Collator's settings as generated with stri_opts_collator; NULL for default settings

Value

  • Each function discussed returns a character vector.

Details

Vectorized over str, pattern, and replacement.

These are locale-sensitive operations. See stringi-search-coll for more details on locale-sensitive text searching in stringi.

These functions scan the input string for matches of the pattern. Input that is not part of any match is left unchanged; each match is replaced in the result by the replacement string.

See Also

Other locale_sensitive: %!==%, %!=%, %<=%< a="">, %<%< a="">, %===%, %==%, %>=%, %>%, %stri!==%, %stri!=%, %stri<=%< a="">, %stri<%< a="">, %stri===%, %stri==%, %stri>=%, %stri>%; stri_cmp, stri_cmp_eq, stri_cmp_equiv, stri_cmp_ge, stri_cmp_gt, stri_cmp_le, stri_cmp_lt, stri_cmp_neq, stri_cmp_nequiv, stri_compare; stri_count_coll; stri_detect_coll; stri_duplicated, stri_duplicated_any; stri_enc_detect2; stri_extract_all_coll, stri_extract_first_coll, stri_extract_first_coll, stri_extract_last_coll, stri_extract_last_coll; stri_extract_words; stri_locate_all_coll, stri_locate_first_coll, stri_locate_first_coll, stri_locate_last_coll, stri_locate_last_coll; stri_locate_boundaries; stri_locate_words; stri_opts_collator; stri_order, stri_sort; stri_split_boundaries; stri_split_coll; stri_trans_tolower, stri_trans_totitle, stri_trans_toupper; stri_unique; stri_wrap; stringi-locale; stringi-search-coll

Other search_coll: stri_count_coll; stri_detect_coll; stri_extract_all_coll, stri_extract_first_coll, stri_extract_first_coll, stri_extract_last_coll, stri_extract_last_coll; stri_locate_all_coll, stri_locate_first_coll, stri_locate_first_coll, stri_locate_last_coll, stri_locate_last_coll; stri_split_coll; stringi-search-coll; stringi-search

Other search_replace: stri_replace_all_charclass, stri_replace_first_charclass, stri_replace_first_charclass, stri_replace_last_charclass, stri_replace_last_charclass; stri_replace_all_fixed, stri_replace_first_fixed, stri_replace_first_fixed, stri_replace_last_fixed, stri_replace_last_fixed; stri_replace_all_regex, stri_replace_first_regex, stri_replace_first_regex, stri_replace_last_regex, stri_replace_last_regex; stri_replace_all; stri_replace_first; stri_replace_last; stri_replace_na; stri_replace; stringi-search

Examples

Run this code
s <- "Lorem ipsum dolor sit amet, consectetur adipisicing elit."

if (stri_install_check(silent=TRUE))
stri_replace_all_coll(s, "", "#")

if (stri_install_check(silent=TRUE))
stri_replace_all_coll(s, "o", "0")

Run the code above in your browser using DataLab