Description Usage Arguments Details Value
Takes a single string and converts it so that it uses the desiginated separator and casing style.
1 2 3 | convert_string(source_str, source_sep = NULL, ignore = NULL,
target_sep = "_", target_case = "all_lower", special_caps = NULL,
break_alpha_blocks = FALSE)
|
source_str |
A character string to convert to a new separator and/or casing style. Non-character types will be forced to character with a warning. |
source_sep |
An optional character string specifying the character(s) or
pattern used as as separator in the source string. The splitting is handled
by |
ignore |
Only used if the source separator is auto-detected (i.e.,
|
target_sep |
A character string describing the character(s) to be used
as a separator in the converted string. Defaults to an underscore ("_"). If
|
target_case |
The casing style to be applied to the converted string.
Casing-only options include: |
special_caps |
An optional string vector of words that should be capitalized as specified in the string vector. They will be converted to lowercase for matching and matching words will be updated to match the version provided in the string vector. |
break_alpha_blocks |
If TRUE, conversion from camel case will break up capitalized blocks of letters to treat each letter as a single word. If FALSE (the default behavior), conversion will try to honor alpha blocks of three or more characters as single words. Where two capitalized characters occur together, they will be broken up unless they occur at the end of the string. |
This function implements the core behavior of the package for a single string - it is not vectorized and is not intended for external use. It takes an optional argument allowing the user to specify a source separator style.
If a source separator style is not given, it will attempt to identify what - if any - character is used as a separator.
Based on the given or identified source separator, the string is then broken up and converted to the target separator and casing style.
If the input is a character string - or is successfully converted -
and the source separator is given - or can be auto-detected - the output
will be a character string using the separator and casing style specified
in target_sep
and target_case
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.