云日志服务 LTS-编码解码函数:url_decoding

时间:2024-05-23 10:48:52

url_decoding

对数据进行URL解码。

  • 函数格式
    url_decoding(value, plus=false)
  • 参数说明

    参数名称

    参数类型

    是否必填

    说明

    value

    String

    被解码的值。

    plus

    Boolean

    是否将加号转换为空格,默认为false。

    • true:将加号转换为空格。
    • false:不转换加号为空格。
  • 返回结果

    返回解码后的字符串。

  • 函数示例
    1. 示例1:对数据进行URL解码。
      • 测试数据
        {
          "content": "https%3A%2F%www.example.org%2FHello%2Fasdah"
        }
      • 加工规则
        e_set("URL",url_decoding(v("content")))
      • 加工结果
        content : https%3A%2F%www.example.org%2FHello%2Fasdah 
        URL : https://www.example.org/hello/asdah
    2. 示例2:对数据进行URL解码。其中,未设置plus参数,不转换数据中的加号为空格。
      • 测试数据
        {
          "content": "/answer?event_date=2022-06-30+09%3A06%3A53%20123"
        }
      • 加工规则
        e_set("URL",url_decoding(v("content")))
      • 加工结果
        content:/answer?event_date=2022-06-30+09%3A06%3A53%20123
        URL:/answer?event_date=2022-06-30+09:06:53 123
    3. 示例3:对数据进行URL解码。其中,设置plus参数为true,将数据中的加号转换为空格。
      • 测试数据
        {
          "content": "/answer?event_date=2022-06-30+09%3A06%3A53%20123"
        }
      • 加工规则
        e_set("URL",url_decoding(v("content"),plus=true))
      • 加工结果
        content:/answer?event_date=2022-06-30+09%3A06%3A53%20123
        URL:/answer?event_date=2022-06-30 09:06:53 123
support.huaweicloud.com/usermanual-lts/lts_07_0150.html