Censor or erase quoted substrings in a text
censor_quoted_text.Rd
This function takes a character
string or vector and replaces each character
in each quoted substrings with a replacement character (by default "_"). When
suppress_quoting_char is FALSE (the default), the function preserves the original
opening and closing quotes and only censors the inner content. When TRUE, the quotes
are also replaced.
Examples
# Censor quoted content and keep the quotes:
text <- c("Example: \"Rat-terrier\" (aka 'Teddy Roosevelt Terrier')"
, "have served into a 'Truffe-terrier company'.")
censor_quoted_text(text, char_for_replacing_each_char = "_", suppress_quoting_char = FALSE)
#> Example: "Rat-terrier" (aka 'Teddy Roosevelt Terrier')
#> "Example: \"___________\" (aka '_______________________')"
#> have served into a 'Truffe-terrier company'.
#> "have served into a '______________________'."
# Remove quoted content and also remove the quotes:
censor_quoted_text(text, char_for_replacing_each_char = "", suppress_quoting_char = TRUE)
#> Example: "Rat-terrier" (aka 'Teddy Roosevelt Terrier')
#> "Example: (aka )"
#> have served into a 'Truffe-terrier company'.
#> "have served into a ."