substring_index
function
Applies to: Databricks SQL
Databricks Runtime
Returns the substring of expr
before count
occurrences of the delimiter delim
.
Syntax
substring_index(expr, delim, count)
Arguments
expr
: ASTRING
orBINARY
expression.delim
: An expression matching the type ofexpr
specifying the delimiter.count
: AnINTEGER
expression to count the delimiters.
Returns
The result matches the type of expr
.
If count
is positive, everything to the left of the final delimiter (counting from the left) is returned.
If count
is negative, everything to the right of the final delimiter (counting from the right) is returned.
Examples
> SELECT substring_index('www.apache.org', '.', 2);
www.apache
Related functions
Tilbakemeldinger
https://aka.ms/ContentUserFeedback.
Kommer snart: Gjennom 2024 faser vi ut GitHub Issues som tilbakemeldingsmekanisme for innhold, og erstatter det med et nytt system for tilbakemeldinger. Hvis du vil ha mer informasjon, kan du se:Send inn og vis tilbakemelding for