Learn R Programming

podcleaner (version 0.1.2)

utils_paste_if_found: Conditionally amend character string vector.

Description

Searches for specified pattern in provided character string. Return pasted provided character string(s) if found or provided default character string if not.

Usage

utils_paste_if_found(regex_filter, string_filter, default, ignore_case, ...)

Arguments

regex_filter

Pattern to look for provided as a character string regex.

string_filter

Character string vector to search into for the pattern provided in regex_filter above.

default

Character string returned if pattern provided in regex_filter not found.

ignore_case

Boolean specifying whether case should be ignored (TRUE) or not (FALSE).

...

Character string(s) to be paste together using a space as separator and returned if pattern provided in regex_filter found.

Value

A character string vector.

Examples

Run this code
# NOT RUN {
  utils_paste_if_found(
    "^glasgow", c("glasgow-entrepreneurs", "aberdeen-entrepreneurs"),
    "pattern not found", TRUE, "pattern", "found"
  )
# }

Run the code above in your browser using DataLab