punycode_from_string()

使用 版本 下拉選單切換服務。 了解更多關於導航的資訊。
Apply to: ✅ Microsoft Fabric ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel

將輸入字串編碼為 Punycode 表單。 結果字串只包含 ASCII 字元。 結果字串開頭不是 「xn」。

語法

punycode_from_string('input_string')

深入瞭解 語法慣例。

參數

姓名 類型 必要 描述
input_string string ✔️ 要編碼為 punycode 窗體的字串。 函式接受一個字串自變數。

傳回

  • 傳 string 回 ,表示punycode編碼的原始字串。
  • 如果編碼失敗,則傳回空的結果。

範例

 print encoded = punycode_from_string('académie-française')
編碼
acadmie-franaise-npb1a
 print domain='艺术.com'
| extend domain_vec = split(domain, '.')
| extend encoded_host = punycode_from_string(tostring(domain_vec[0]))
| extend encoded_domain = strcat('xn--', encoded_host, '.', domain_vec[1])
網域 domain_vec encoded_host encoded_domain
藝術.com [“藝術”,“com”] cqv902d xn--cqv902d.com