Converts a string into camelCase.
Function call | Output |
---|---|
camelCase("my-text-file") | myTextFile |
camelCase("my text file") | myTextFile |
camelCase("my_text_file") | myTextFile |
Related macro: ConvertToCamelCaseMacro
Capitalizes the first letter of the parameter.
Function call | Output |
---|---|
capitalize("aJavaClass") | AJavaClass |
capitalize("AJavaClass") | AJavaClass |
capitalize("10 more coffees please") | 10 more coffees please |
Related macro: CapitalizeMacro
Capitalizes all the letters of a CamelCase name passed as the parameter, and inserts an underscore between the parts.
Function calls | Output |
---|---|
capitalizeAndUnderscore("my-text-file") | MY_TEXT_FILE |
capitalizeAndUnderscore("my text file") | MY_TEXT_FILE |
capitalizeAndUnderscore("my_text_file") | MY_TEXT_FILE |
Related macro: CapitalizeAndUnderscoreMacro
Returns a concatenation of all the strings passed to the function as parameters.
Function call | Output |
---|---|
concat() | "" (as in empty string) |
concat("unicorns ", "are real") | unicorns are real |
concat("unicorns ", 3, "are real", 6.0, false) | unicorns are real |
This function ignores number and boolean values, and concatenates only String values.
Related macro: ConcatMacro
Replaces the first letter of the parameter with the corresponding lowercase letter.
Function call | Output |
---|---|
decapitalize("Unicorns") | unicorns |
decapitalize("unicorns") | unicorns |
Related macro: DecapitalizeMacro
Escapes the string specified as the parameter.
Function call | Output |
---|---|
escapeString("\b \t \n \f \r \ Ű 漢") | b \t \n \f r \ Ű 漢 |
escapeString("\b \t \n \f \r \\") | \b \t \n \f \r \\ |
Related macro: EscapeStringMacro Escaping logic: StringUtil
Returns the first word of the string passed as the parameter.
Function call | Output |
---|---|
firstWord("Unicorns") | Unicorns |
firstWord("Unicorns are real") | Unicorns |
Related macro: FirstWordMacro
Converts a camelCase string into lower case and inserts n-dashes as separators.
Function call | Output |
---|---|
lowercaseAndDash("UnicornsAreReal") | unicorns-are-real |
lowercaseAndDash("unicornsAreReal") | unicorns-are-real |
lowercaseAndDash("unicorns are real") | unicorns-are-real |
lowercaseAndDash("unicorns_are_real") | unicorns-are-real |
Related macro: SplitWordsMacro.LowercaseAndDash
Find all occurrences of Pattern in a String and replace it with Replacement. You can specify the pattern as a regular expression to find everything that matches it in the string.
Based on Cucumber step descriptions:
Function call | Output |
---|---|
regularExpression("I have 4 apples", "\d+", "{int}") | I have {int} apples |
Related macro: RegExMacro
Converts a string into snake_case.
Function call | Output |
---|---|
snakeCase("FezesAreCool") | fezes_are_cool |
snakeCase("fezesAreCool") | fezes_are_cool |
snakeCase("fezes are cool") | fezes_are_cool |
snakeCase("fezes-are-cool") | fezes_are_cool |
Related macro: SplitWordsMacro.SnakeCaseMacro
Converts a string into lowercase and inserts spaces as separators.
NOTE: contrary to the official documentation it doesn't convert the input value to lowercase.
Function call | Output |
---|---|
spaceSeparated("FezesAreCool") | Fezes Are Cool |
spaceSeparated("fezesAreCool") | fezes Are Cool |
spaceSeparated("FEZES_ARE_COOL") | FEZES ARE COOL |
spaceSeparated("fezes-are-cool") | fezes are cool |
Related macro: SnakeCaseMacro.SpaceSeparated
Replaces spaces with underscores in the string passed as the parameter.
Function call | Output |
---|---|
spacesToUnderscores("Fezes Are Cool") | Fezes_Are_Cool |
spacesToUnderscores("fezesAreCool") | fezesAreCool |
spacesToUnderscores("FEZES_ARE_COOL") | FEZES_ARE_COOL |
spacesToUnderscores("fezes-are-cool") | fezes-are-cool |
Related macro: ReplaceSpacesWithUnderscoresMacro
Removes the extension after the specified delimiter and returns only the filename.
This is helpful for test file names (for example, substringBefore($FileName$,".")
returns component-test in component-test.js).
Function call | Output |
---|---|
substringBefore("AJavaClass.java", ".") | AJavaClass |
substringBefore("list, of, items", ", ") | list |
Related macro: SubstringBeforeMacro
Replaces underscores with camelCase letters in the string passed as the parameter.
Function call | Output |
---|---|
underscoresToCamelCase("Fezes Are Cool") | fezes are cool |
underscoresToCamelCase("fezesAreCool") | fezesarecool |
underscoresToCamelCase("FEZES_ARE_COOL") | fezesAreCool |
underscoresToCamelCase("fezes-are-cool") | fezes-are-cool |
Related macro: ConvertToCamelCaseMacro.ReplaceUnderscoresToCamelCaseMacro
Replaces underscores with spaces in the string passed as the parameter.
Function call | Output |
---|---|
underscoresToSpaces("Fezes Are Cool") | Fezes Are Cool |
underscoresToSpaces("fezesAreCool") | fezesAreCool |
underscoresToSpaces("FEZES_ARE_COOL") | FEZES ARE COOL |
underscoresToSpaces("fezes-are-cool") | fezes-are-cool |
Related macro: ReplaceUnderscoresWithSpacesMacro