更新时间:2024-05-23 GMT+08:00
分享

常见操作

str_strip

删除字符串中指定的字符。

  • 函数格式
    str_strip(value, chars)
  • 参数说明

    参数名称

    参数类型

    是否必填

    说明

    value

    任意(自动转为String)

    需要被修改的原字符串。

    chars

    任意(自动转为String)

    字符串开头和结尾需要删除的字符集,默认为\t\r\n。

  • 返回结果

    修改后的字符串。

  • 函数示例
    1. 示例1:删除空格。
      • 测试数据
        {
          "source":"      lts"
        }
      • 加工规则
        e_set("str_strip", str_strip(v("source")))
      • 加工结果
        source:      lts 
        str_strip: lts
    2. 示例2:删除开头和结尾是#的字符。
      • 测试数据
        {
          "source": "##lts#"
        }
      • 加工规则
        e_set("str_strip", str_strip(v("source"), "#"))
      • 加工结果
        source: ##lts#
        str_strip: lts

str_lstrip

删除字符串开头指定的字符。

  • 函数格式
    str_lstrip(value, chars)
  • 参数说明

    参数名称

    参数类型

    是否必填

    说明

    value

    任意(自动转为String)

    需要被修改的原字符串。

    chars

    任意(自动转为String)

    字符串开头需要删除的字符集,默认为空格。

  • 返回结果

    修改后的字符串。

  • 函数示例
    • 测试数据:无
    • 加工规则
      e_set("str_strip", str_lstrip("**123**", "*"))
    • 加工结果
      str_strip: 123**

str_rstrip

删除字符串结尾指定的字符。

  • 函数格式
    str_rstrip(value, chars)
  • 参数说明

    参数名称

    参数类型

    是否必填

    说明

    value

    任意(自动转为String)

    需要被修改的原字符串。

    chars

    任意(自动转为String)

    字符串结尾需要删除的字符集,默认为空格。

  • 返回结果

    修改后的字符串。

  • 函数示例
    • 测试数据:无
    • 加工规则
      e_set("str_strip", str_rstrip("**123**", "*"))
    • 加工结果
      str_strip: 123**

str_lower

将字符串中所有大写字符转换为小写字符。

  • 函数格式
    str_lower(value)
  • 参数说明

    参数名称

    参数类型

    是否必填

    说明

    value

    任意(自动转为String)

    需要被转换的字符串。

  • 返回结果

    转换后的字符串。

  • 函数示例
    • 测试数据
      {
       "name": "LTs"
      }
    • 加工规则
      e_set("str_lower", str_lower(v("name")))
    • 加工结果
      name: LTs 
      str_lower: lts

str_upper

将字符串中所有小写字符转换为大写字符。

  • 函数格式
    str_upper(value)
  • 参数说明

    参数名称

    参数类型

    是否必填

    说明

    value

    任意(自动转为String)

    需要被转换的字符串。

  • 返回结果

    转换后的字符串。

  • 函数示例
    • 测试数据
      {
       "name": "LTs"
      }
    • 加工规则
      e_set("str_upper", str_upper(v("name")))
    • 加工结果
      name: LTs 
      str_upper: LTS

str_title

将所有单词的第一个字母转化为大写,其余字母均为小写。

  • 函数格式
    str_title(value)
  • 参数说明

    参数名称

    参数类型

    是否必填

    说明

    value

    任意(自动转为String)

    需要被转换的字符串。

  • 返回结果

    转换后的字符串。

  • 函数示例
    • 测试数据
      {
        "name":  "for example"
      }
    • 加工规则
      e_set("str_title", str_title(v("name")))
    • 加工结果
      name:for example
      example str_title: For Exampl

str_capitalize

将字符串的第一个字母转化为大写,其他字母转化为小写。

  • 函数格式
    str_capitalize(value)
  • 参数说明

    参数名称

    参数类型

    是否必填

    说明

    value

    任意(自动转为String)

    需要被转换的字符串。

  • 返回结果

    转换后的字符串。

  • 函数示例
    • 测试数据
      {
        "value": "welcome to xian"
      }
    • 加工规则
      e_set("str_capitalize", str_capitalize(v("value")))
    • 加工结果
      value:welcome to xian 
      str_capitalize: Welcome to xian

str_swapcase

对字符串的大小写字母进行转换。

  • 函数格式
    str_swapcase(value)
  • 参数说明

    参数名称

    参数类型

    是否必填

    说明

    value

    任意(自动转为String)

    需要被转换的字符串。

  • 返回结果

    转换后的字符串。

  • 函数示例
    • 测试数据
      {
       "name": "this is lts"
      }
    • 加工规则
      e_set("str_swapcase", str_swapcase(v("name")))
    • 加工结果
      name: this is lts 
      str_swapcase: THIS IS LTS
分享:

    相关文档

    相关产品