Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The LASTSUBSTRINGAFTER function returns the substring after the last occurrence of a delimiter.
An Azure Cosmos DB system function that splits a string at the last delimiter and returns the suffix portion.
Syntax
LASTSUBSTRINGAFTER(<string_expr_1>, <string_expr_2>)
Arguments
| Description | |
|---|---|
string_expr_1 |
A string expression to search. |
string_expr_2 |
A string expression that specifies the delimiter. |
Return types
Returns a string expression.
Examples
This section contains examples of how to use this query language construct.
Get the text after the last delimiter
In this example, the LASTSUBSTRINGAFTER function returns the portion after the last / character.
SELECT VALUE {
fileName: LASTSUBSTRINGAFTER("/products/shoes/boots", "/"),
suffix: LASTSUBSTRINGAFTER("A-B-C", "-")
}
[
{
"fileName": "boots",
"suffix": "C"
}
]
Get the text after the last string delimiter
In this example, the LASTSUBSTRINGAFTER function returns the portion after the last :: delimiter.
SELECT VALUE {
leaf: LASTSUBSTRINGAFTER("bike::touring::frame", "::")
}
[
{
"leaf": "frame"
}
]
Remarks
- This function doesn't use the index.