EVOLUTION-MANAGER
Edit File: caseconverter.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Specific case converter shortcuts</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for caseconverter {snakecase}"><tr><td>caseconverter {snakecase}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Specific case converter shortcuts</h2> <h3>Description</h3> <p>Wrappers around <code>to_any_case()</code> </p> <h3>Usage</h3> <pre> to_snake_case(string, abbreviations = NULL, sep_in = "[^[:alnum:]]", parsing_option = 1, transliterations = NULL, numerals = "middle", sep_out = NULL, unique_sep = NULL, empty_fill = NULL, prefix = "", postfix = "") to_lower_camel_case(string, abbreviations = NULL, sep_in = "[^[:alnum:]]", parsing_option = 1, transliterations = NULL, numerals = "middle", sep_out = NULL, unique_sep = NULL, empty_fill = NULL, prefix = "", postfix = "") to_upper_camel_case(string, abbreviations = NULL, sep_in = "[^[:alnum:]]", parsing_option = 1, transliterations = NULL, numerals = "middle", sep_out = NULL, unique_sep = NULL, empty_fill = NULL, prefix = "", postfix = "") to_screaming_snake_case(string, abbreviations = NULL, sep_in = "[^[:alnum:]]", parsing_option = 1, transliterations = NULL, numerals = "middle", sep_out = NULL, unique_sep = NULL, empty_fill = NULL, prefix = "", postfix = "") to_parsed_case(string, abbreviations = NULL, sep_in = "[^[:alnum:]]", parsing_option = 1, transliterations = NULL, numerals = "middle", sep_out = NULL, unique_sep = NULL, empty_fill = NULL, prefix = "", postfix = "") to_mixed_case(string, abbreviations = NULL, sep_in = "[^[:alnum:]]", parsing_option = 1, transliterations = NULL, numerals = "middle", sep_out = NULL, unique_sep = NULL, empty_fill = NULL, prefix = "", postfix = "") to_lower_upper_case(string, abbreviations = NULL, sep_in = "[^[:alnum:]]", parsing_option = 1, transliterations = NULL, numerals = "middle", sep_out = NULL, unique_sep = NULL, empty_fill = NULL, prefix = "", postfix = "") to_upper_lower_case(string, abbreviations = NULL, sep_in = "[^[:alnum:]]", parsing_option = 1, transliterations = NULL, numerals = "middle", sep_out = NULL, unique_sep = NULL, empty_fill = NULL, prefix = "", postfix = "") to_swap_case(string, abbreviations = NULL, sep_in = "[^[:alnum:]]", parsing_option = 1, transliterations = NULL, numerals = "middle", sep_out = NULL, unique_sep = NULL, empty_fill = NULL, prefix = "", postfix = "") to_sentence_case(string, abbreviations = NULL, sep_in = "[^[:alnum:]]", parsing_option = 1, transliterations = NULL, numerals = "middle", sep_out = NULL, unique_sep = NULL, empty_fill = NULL, prefix = "", postfix = "") to_random_case(string, abbreviations = NULL, sep_in = "[^[:alnum:]]", parsing_option = 1, transliterations = NULL, numerals = "middle", sep_out = NULL, unique_sep = NULL, empty_fill = NULL, prefix = "", postfix = "") to_title_case(string, abbreviations = NULL, sep_in = "[^[:alnum:]]", parsing_option = 1, transliterations = NULL, numerals = "middle", sep_out = NULL, unique_sep = NULL, empty_fill = NULL, prefix = "", postfix = "") </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>string</code></td> <td> <p>A string (for example names of a data frame).</p> </td></tr> <tr valign="top"><td><code>abbreviations</code></td> <td> <p>character. (Case insensitive) matched abbreviations are surrounded by underscores. In this way, they can get recognized by the parser. This is useful when e.g. <code>parsing_option</code> 1 is needed for the use case, but some abbreviations but some substrings would require <code>parsing_option</code> 2. Furthermore, this argument also specifies the formatting of abbreviations in the output for the cases title, mixed, lower and upper camel. E.g. for upper camel the first letter is always in upper case, but when the abbreviation is supplied in upper case, this will also be visible in the output. </p> <p>Use this feature with care: One letter abbreviations and abbreviations next to each other are hard to read and also not easy to parse for further processing.</p> </td></tr> <tr valign="top"><td><code>sep_in</code></td> <td> <p>(short for separator input) if character, is interpreted as a regular expression (wrapped internally into <code>stringr::regex()</code>). The default value is a regular expression that matches any sequence of non-alphanumeric values. All matches will be replaced by underscores (additionally to <code>"_"</code> and <code>" "</code>, for which this is always true, even if <code>NULL</code> is supplied). These underscores are used internally to split the strings into substrings and specify the word boundaries.</p> </td></tr> <tr valign="top"><td><code>parsing_option</code></td> <td> <p>An integer that will determine the parsing_option. </p> <ul> <li><p>1: <code>"RRRStudio" -> "RRR_Studio"</code> </p> </li> <li><p>2: <code>"RRRStudio" -> "RRRS_tudio"</code> </p> </li> <li><p>3: <code>"RRRStudio" -> "RRRSStudio"</code>. This will become for example <code>"Rrrstudio"</code> when we convert to lower camel case. </p> </li> <li><p>-1, -2, -3: These <code>parsing_options</code>'s will suppress the conversion after non-alphanumeric values. </p> </li> <li><p>0: no parsing </p> </li></ul> </td></tr> <tr valign="top"><td><code>transliterations</code></td> <td> <p>A character vector (if not <code>NULL</code>). The entries of this argument need to be elements of <code>stringi::stri_trans_list()</code> (like "Latin-ASCII", which is often useful) or names of lookup tables (currently only "german" is supported). In the order of the entries the letters of the input string will be transliterated via <code>stringi::stri_trans_general()</code> or replaced via the matches of the lookup table. When named character elements are supplied as part of 'transliterations', anything that matches the names is replaced by the corresponding value. You should use this feature with care in case of <code>case = "parsed"</code>, <code>case = "internal_parsing"</code> and <code>case = "none"</code>, since for upper case letters, which have transliterations/replacements of length 2, the second letter will be transliterated to lowercase, for example Oe, Ae, Ss, which might not always be what is intended. In this case you can make usage of the option to supply named elements and specify the transliterations yourself.</p> </td></tr> <tr valign="top"><td><code>numerals</code></td> <td> <p>A character specifying the alignment of numerals (<code>"middle"</code>, <code>left</code>, <code>right</code> or <code>asis</code>). I.e. <code>numerals = "left"</code> ensures that no output separator is in front of a digit.</p> </td></tr> <tr valign="top"><td><code>sep_out</code></td> <td> <p>(short for separator output) String that will be used as separator. The defaults are <code>"_"</code> and <code>""</code>, regarding the specified <code>case</code>. When <code>length(sep_out) > 1</code>, the last element of <code>sep_out</code> gets recycled and separators are incorporated per string according to their order.</p> </td></tr> <tr valign="top"><td><code>unique_sep</code></td> <td> <p>A string. If not <code>NULL</code>, then duplicated names will get a suffix integer in the order of their appearance. The suffix is separated by the supplied string to this argument.</p> </td></tr> <tr valign="top"><td><code>empty_fill</code></td> <td> <p>A string. If it is supplied, then each entry that matches "" will be replaced by the supplied string to this argument.</p> </td></tr> <tr valign="top"><td><code>prefix</code></td> <td> <p>prefix (string).</p> </td></tr> <tr valign="top"><td><code>postfix</code></td> <td> <p>postfix (string).</p> </td></tr> </table> <h3>Value</h3> <p>A character vector according the specified parameters above. </p> <p>A character vector according the specified target case. </p> <h3>Note</h3> <p>caseconverters are vectorised over <code>string</code>, <code>sep_in</code>, <code>sep_out</code>, <code>empty_fill</code>, <code>prefix</code> and <code>postfix</code>. </p> <h3>Author(s)</h3> <p>Malte Grosser, <a href="mailto:malte.grosser@gmail.com">malte.grosser@gmail.com</a> </p> <p>Malte Grosser, <a href="mailto:malte.grosser@gmail.com">malte.grosser@gmail.com</a> </p> <h3>See Also</h3> <p><a href="https://github.com/Tazinho/snakecase">snakecase on github</a>, <code><a href="to_any_case.html">to_any_case</a></code> for flexible high level conversion and more examples. </p> <h3>Examples</h3> <pre> strings <- c("this Is a Strange_string", "AND THIS ANOTHER_One", NA) to_snake_case(strings) to_lower_camel_case(strings) to_upper_camel_case(strings) to_screaming_snake_case(strings) to_lower_upper_case(strings) to_upper_lower_case(strings) to_parsed_case(strings) to_mixed_case(strings) to_swap_case(strings) to_sentence_case(strings) to_random_case(strings) to_title_case(strings) </pre> <hr /><div style="text-align: center;">[Package <em>snakecase</em> version 0.11.0 <a href="00Index.html">Index</a>]</div> </body></html>