你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
substring()
Applies to: ✅ Microsoft Fabric ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Extracts a substring from the source string starting from some index to the end of the string.
Optionally, the length of the requested substring can be specified.
Syntax
substring(
source,
startingIndex [,
length])
Learn more about syntax conventions.
Parameters
Name | Type | Required | Description |
---|---|---|---|
source | string |
✔️ | The string from which to take the substring. |
startingIndex | int |
✔️ | The zero-based starting character position of the requested substring. If a negative number, the substring will be retrieved from the end of the source string. |
length | int |
The requested number of characters in the substring. The default behavior is to take from startingIndex to the end of the source string. |
Returns
A substring from the given string. The substring starts at startingIndex (zero-based) character position and continues to the end of the string or length characters if specified.
Examples
substring("123456", 1) // 23456
substring("123456", 2, 2) // 34
substring("ABCD", 0, 2) // AB
substring("123456", -2, 2) // 56