你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
trim_start()
删除指定正则表达式的前导匹配项。
语法
trim_start(
regex,
source)
详细了解语法约定。
参数
名称 | 类型 | 必需 | 说明 |
---|---|---|---|
regex | string |
✔️ | 要从 source 的开头剪裁的字符串或正则表达式。 |
source | string |
✔️ | 要从中剪裁 regex 的源字符串。 |
返回
修剪 source 开头的 regex 匹配项后的 source 。
示例
以下语句从 string_to_trim 的开头剪裁 substring。
let string_to_trim = @"https://bing.com";
let substring = "https://";
print string_to_trim = string_to_trim,trimmed_string = trim_start(substring,string_to_trim)
输出
string_to_trim | trimmed_string |
---|---|
https://bing.com | bing.com |
下一语句从字符串的开头剪裁所有非单词字符。
range x from 1 to 5 step 1
| project str = strcat("- ","Te st",x,@"// $")
| extend trimmed_str = trim_start(@"[^\w]+",str)
输出
str | trimmed_str |
---|---|
- Te st1// $ | Te st1// $ |
- Te st2// $ | Te st2// $ |
- Te st3// $ | Te st3// $ |
- Te st4// $ | Te st4// $ |
- Te st5// $ | Te st5// $ |
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈