使用 版本 下拉選單切換服務。 了解更多關於導航的資訊。
Apply to: ✅ Microsoft Fabric ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
傳回輸入字串的長度,以字元為單位。
注意
此函式會計算 Unicode 字碼點。
語法
strlen(
資料來源)
深入瞭解 語法慣例。
參數
| 姓名 | 類型 | 必要 | 描述 |
|---|---|---|---|
| source | string |
✔️ | 要傳回長度的字串。 |
傳回
傳回輸入字串的長度,以字元為單位。
範例
字母字串
print length = strlen("hello")
輸出
| length |
|---|
| 5 |
字母和符號的字串
print length = strlen("⒦⒰⒮⒯⒪")
輸出
| length |
|---|
| 5 |
具有 grapheme 的字串
print strlen('Çedilla') // the first character is a grapheme cluster
// that requires 2 code points to represent
輸出
| length |
|---|
| 8 |