Uri.Parts

语法

Uri.Parts(absoluteUri as text) as record

关于

以记录形式返回输入 absoluteUri 的组成部分,包含方案、主机、端口、路径、查询、片段、用户名和密码等值。

示例 1

查找绝对 URI“www.adventure-works.com”的组成部分。

使用情况

Uri.Parts("www.adventure-works.com")

输出

[
    Scheme = "http",
    Host = "www.adventure-works.com",
    Port = 80,
    Path = "/",
    Query = [],
    Fragment = "",
    UserName = "",
    Password = ""
]

示例 2

解码百分比编码的字符串。

使用情况

let
    UriUnescapeDataString = (data as text) as text => Uri.Parts("http://contoso?a=" & data)[Query][a]
in
    UriUnescapeDataString("%2Bmoney%24")

输出

"+money$"