change-column-case

Convert the case of text values in a column (e.g. UPPERCASE, lowercase, camelCase, hyphen-case, etc)

Functionality

For a column in a datatable, change the case to one of the supported case patterns. The changed text can either overwrite the original text in the column OR be placed in a different column.

Arguments

Inputs:

data: The input datatable

column: The column with text you want to convert to a different case

case: The case pattern you want for your converted text (see options in "Supported case patterns" below)

target: The name of the column to contain the converted case (if you want the output to be in a separate column from the source noted in the "column" argument)

Output:

output: datatable with converted case (either in the same column it came from or a new target column)

Examples

Supported case patterns

This table shows available case options.

CaseExampleDescription

camel

thisIsCamelCase

first letter of each word is uppercase except very first letter

constant

THIS_IS_CONSTANT_CASE

upper case string with an underscore between words.

dot

this.is.dot.case

lower case string with a period between words

hyphen

this-is-hyphen-case

same as kebab

header

This-Is-Header-Case

like kebab and hyphen but with uppercase first letters

kebab

this-is-kebab-case

same as hyphen

lower

thisislowercase

all lowercase

lowerfirst

HELLO becomes hELLO

changes the first character to lowercase

no

this is no case

lowercase with spaces between words

param

version 1.2.10 becomes version-1-2-10

lower case string with a hyphen between words

pascal

ThisIsPascalCase

first letter of each word is uppercase

path

this/is/path/case

lowercase with slash between words

sentence

This is sentence case

only the first letter is uppercase

snake

this_is___snake_case

lowercase string with underscores between words

swap

SWAPcase becomes swapCASE

uppercase become lowercase and lowercase become uppercase

title

This Is the Way Titlecase Looks

most words have uppercase first letter

upper

THISISUPPERCASE

all uppercase

upperfirst

hello becomes Hello

changes the first character to uppercase

Possible use cases

  • Standardizing values in a column as a harmonization step (e.g. change "uk" to be "UK")

  • Making text values easier to read.

Last updated