change-column-case

Description

change-column-case adaptor converts the case of text values in a datatable column to a specified format.

The list of supported case patterns are:

  • camel case: text with the separator denoted by the next word capitalised. OfMice and menofMiceAndMen

  • capital case: space separated text with each word capitalised. OfMice and menOf Mice And Men

  • constant case: upper case text with an underscore between words. OfMice and menOF_MICE_AND_MEN

  • dot case: lower case string with a period between words. OfMice and menof.mice.and.men

  • header case: dash separated string of capitalised words. OfMice and menOf-Mice-And-Men

  • hyphen case: lower cased string with dashes between words (same as kebab case). OfMice and menof-mice-and-men

  • kebab case: lower cased string with dashes between words (same as hyphen case). OfMice and menof-mice-and-men

  • lower case: text with all letters lower case. OfMice and menofmice and men

  • no case: lower cased string with spaces between words. OfMice and menof mice and men

  • param case: lower cased string with dashes between words (same as kebab case). OfMice and menof-mice-and-men

  • pascal case: string of capitalised words without separators. OfMice and menOfMiceAndMen

  • path case: lower case string with slashes between words. OfMice and menof/mice/and/men

  • sentence case: lower case with spaces between words and capitalised first letter. OfMice and menOf mice and men

  • snake case: lower case string with underscores between words. OfMice and menof_mice_and_men

  • sponge case: string with random capitalisation applied. OfMice and menoFmiCe anD mEN

  • swap case: swaps every character from upper to lower case, or lower to upper case. OfMice and menoFmICE AND MEN

  • title case: a mixed-case style following English language rules. OfMice and menOfMice and Men

  • upper case: text with all letters upper case. OfMice and menOFMICE AND MEN

Inputs

data Type: datatable Required: Yes The datatable containing the column to be converted.

column Type: text Required: Yes The column to be converted.

case Type: text Required: Yes One of the supported case patterns.

Outputs

data Type: datatable A datatable with target column added.

Examples

Example 1: Standardize values in a column.

Inputs:

data:

Sample IDSex

Sample A

female

Sample B

MALE

Sample C

male

Sample D

Female

Sample E

FEMALE

Sample F

Male

column: Sex

case: upper case

Outputs:

data:

Sample IDSex

Sample A

FEMALE

Sample B

MALE

Sample C

MALE

Sample D

FEMALE

Sample E

FEMALE

Sample F

MALE

-> Standardized the values in column Sex by converting it to uppercase.

Use Cases

  • In categorical variables, changing the case can be part of the process of converting data to a consistent format so certain variables can be treated as the same category regardless of case, aiding in data visualisation.

  • When comparing or matching strings, it's often beneficial to have consistent cases

  • In the process of cleaning and preprocessing data, changing the cases can help identify and handle duplicates more effectively. It aids in detecting and merging records that might have the same information but with different capitalization.

  • Standardizing cases is essential for proper sorting and grouping of data. Without consistent cases, sorting operations may not produce the desired order, and groupings may not capture all similar items due to case variations.

Last updated