Formatting strings

In Wrangler, for columns of string data type, you can use the point-and-click menu to change the case of strings, concatenate strings, and trim whitespace from strings.

To format a String column, follow these steps:

  1. Click the drop-down button next to the column name.

  2. Click Format, and then select the transformation you want to perform.


    The values in the column change to the new format. Wrangler adds the corresponding function, for example uppercase, to the recipe. When you run the data pipeline, the transformation is applied to all values in the column.

Changing the case of strings

For columns with alphabetical characters, you can change the case of all fields in a String column to:

  • UPPERCASE

  • lowercase

  • TitleCase

For example, if you click Format > lowercase on the following column, Wrangler changes all the strings to lowercase.

Input

Output

Input

Output

BREAD

bread

SalAd

salad

miLK

milk

Concatenating strings

You can append characters to the beginning or end of each string in a column. Wrangler concatenates the string to all fields in the column, including empty fields and nulls. You can also choose to create a new column with the concatenated strings.

For example, if you want to add NEW- to the beginning of each string in a column, click Format > Concatenate, select at the beginning and enter NEW- in the Add box:

The output will look like:

Input

Output

Input

Output

bread

NEW-bread

salad

NEW-salad

milk

NEW-milk

Before you concatenate strings, you might want to filter null values and blanks.

For example, the Item column has one empty field and one null field:

If you concatenate NEW- at the beginning of each field, Wrangler concatenates NEW- to all fields, including blanks and nulls:

Input

Output

Input

Output

 

NEW-

bread

NEW-bread

salad

NEW-salad

milk

NEW-milk

null

NEW-null

Trimming extra white spaces from strings

In Wrangler, you can trim leading (ltrim), trailing (rtrim), or both leading and trailing white space (trim) from all strings in a column.

For example, the Item column has fields with extra leading whitespace.

To remove the leading whitespace, click Format > Trim Leading Whitespace.

 

Created in 2020 by Google Inc.