ltrim
function
Applies to: Databricks SQL Databricks Runtime
Returns str
with leading characters within trimStr
removed.
Syntax
ltrim( [trimstr ,] str)
Arguments
trimstr
: An optionalSTRING
expression with the string to be trimmed.str
: ASTRING
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 +
> SELECT '+' || ltrim('ABC' COLLATE UTF8_BINARY, 'acbabSparkSQL ') || '+';
+acbabSparkSQL +
> SELECT '+' || ltrim('ABC' COLLATE UTF8_LCASE, 'acbabSparkSQL ') || '+';
+SparkSQL +