ltrim function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime

Returns str with leading characters within trimStr removed.

Syntax

ltrim( [trimstr ,] str)

Arguments

  • trimstr: An optional STRING expression with the string to be trimmed.

  • str: A STRING expression from which to trim.

Returns

A STRING.

The default for trimStr is a single space. The function removes any leading characters within trimStr from str.

Examples

> SELECT '+' || ltrim('    SparkSQL   ') || '+';
 +SparkSQL   +
> SELECT '+' || ltrim('abc', 'acbabSparkSQL   ') || '+';
 +SparkSQL   +