LPAD

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Prepends padding to a string on the left to a specified length.

Syntax 

1lpad(<string>, <length> [, fill])

Arguments 

Required 

  • <string>: The string to pad.
  • <length>: The desired total length.

Optional 

  • fill: The padding characters. Defaults to space.

Returns 

Returns a text value padded to the specified length.

Considerations 

  • If the string is longer than the specified length, it is truncated on the right.
  • The fill string is repeated as needed.

Examples 

Left Pad 

Pad a string on the left.

1SELECT lpad('hi', 5, 'xy') AS result;

Returns 'xyxhi'.

Related Documentation 

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!