你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
punycode_from_string()
将输入字符串编码为 Punycode 形式。 结果字符串仅包含 ASCII 字符。 结果字符串不以“xn--”开头。
语法
punycode_from_string('input_string')
详细了解语法约定。
参数
名称 | 类型 | 必需 | 说明 |
---|---|---|---|
input_string | string |
✔️ | 要编码为 punycode 形式的字符串。 此函数接受一个字符串参数。 |
返回
- 返回一个表示 punycode 编码的原始字符串的
string
。 - 如果编码失败,则返回空结果。
示例
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 |
相关内容
- 使用 punycode_to_string() 检索已解码的原始字符串。
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈