Skip to contents

Prefix and postfix can include more than one value that are added in the same order provided. For str_fix, the string must be a single character string.

Usage

str_trim_squish(string)

str_fix(
  prefix = NULL,
  string = NULL,
  postfix = NULL,
  sep = "_",
  clean_names = TRUE,
  pad = NULL,
  width = NULL
)

str_prefix(
  string = NULL,
  prefix = NULL,
  sep = "_",
  clean_names = TRUE,
  post = FALSE,
  dttm_sep = "-"
)

str_pad_digits(string, pad = "0", side = "left", width = NULL)

str_extract_digits(string)

str_add_filetype(string, filetype = NULL)

str_remove_filetype(string, filetype = NULL)

str_extract_filetype(string)

Arguments

string

A single string that the attach prefix or postfix is added to.

prefix

Character string or character vector to add to string parameter as a prefix.

postfix

Character string or character vector to add to string parameter as a postfix.

sep

Separator character passed as the collapse parameter of paste().

clean_names

If TRUE, prefix, postfix, and string are all converted to snake case with janitor::make_clean_names().

pad

Single padding character added to digits in string; defaults to "0"

width

Minimum width of padded strings.

post

If TRUE, use the prefix string as a postfix; defaults to FALSE.

dttm_sep

Date time separator. Only used by str_prefix if prefix is "date" or "time" and not accessible when using str_fix or make_filename.

side

Side on which padding character is added (left, right or both).

filetype

File type string

Details

Functions include:

  • str_fix: Add a label, prefix, and postfix to string

  • str_prefix: Add a prefix or a postfix to a string

  • str_add_filetype: Add file type to string

  • str_remove_filetype: Remove file type from string

  • str_extract_filetype: Extract file type from string

  • str_pad_digits: Pad a string with digits

  • str_extract_digits: Extract digits from a string

  • str_trim_squish: remove double-spaces, trailing and leading spaces