splitCamel {FastUtils} | R Documentation |
Split CamelCase or PascalCase Strings
Description
This function splits strings formatted in camelCase or PascalCase into their component words. It can handle words where uppercase letters transition to lowercase letters, and it is capable of handling strings with sequences of uppercase letters followed by lowercase letters, effectively separating acronyms from camelCase beginnings.
Usage
splitCamel(x, conseq = TRUE)
splitPascal(x, conseq = TRUE)
Arguments
x |
A character vector containing CamelCase or PascalCase strings to be split. |
conseq |
Logical indicating whether consecutive uppercase letters should be treated as part of the previous word (TRUE) or as separate words (FALSE). Default is TRUE. |
Value
A list of character vectors, each containing the parts of the corresponding
CamelCase or PascalCase string split at the appropriate transitions.
If conseq
is FALSE, acronyms followed by words are separated.
Source
https://stackoverflow.com/questions/8406974/splitting-camelcase-in-r
Examples
splitCamel("splitCamelCaseIntoWords")
splitCamel(c("fooBar", "FOOBar", "anotherFOOBarTest"), conseq = FALSE)