SpiderFlow-string
时间:2026-02-15
string
string
substring
| 参数名 | 描述 | 可否为空 |
|---|---|---|
| content | 被截取的内容 | 否 |
| beginIndex | 起始位置 | 否 |
| endIndex | 结束位置 | 是 |
TIP
返回值类型:String
截取字符串
从
unhappy中提取happy
${string.substring('unhappy',2)}从
smiles中提取mile
${string.substring('smiles',1,5)}lower
| 参数名 | 描述 | 可否为空 |
|---|---|---|
| content | 要转小写的字符串 | 否 |
TIP
返回值类型:String
字符串转小写
把
hello变成小写hello
${string.lower('HELLO')}upper
| 参数名 | 描述 | 可否为空 |
|---|---|---|
| content | 要转大写的字符串 | 否 |
TIP
返回值类型:String
字符串转大写
把
hello变成大写HELLO
${string.upper('hello')}indexOf
| 参数名 | 描述 | 可否为空 |
|---|---|---|
| content | 被查找的字符串 | 否 |
| str | 要查找的字符串 | 否 |
| fromIndex | 起始位置 | 是 |
TIP
返回值类型:int
获取字符串在被查找字符串中的位置
找
world在hello world中的位置
${string.indexOf('hello world','world')}replace
| 参数名 | 描述 | 可否为空 |
|---|---|---|
| content | 被替换的字符串 | 否 |
| source | 要替换的字符串 | 否 |
| target | 目标字符串 | 否 |
TIP
返回值类型:String
替换字符串
把
Hello,World!替换成Hello,SpiderFlow!
${string.replace('Hello,World','World','SpiderFlow')}replaceAll
| 参数名 | 描述 | 可否为空 |
|---|---|---|
| content | 被替换的字符串 | 否 |
| regx | 正则表达式 | 否 |
| target | 替换字符串 | 否 |
TIP
返回值类型:String
正则替换字符串
把
h1e2l3l4o5替换成hello
${string.replaceAll('h1e2l3l4o5','\\d+','')}replaceFirst
| 参数名 | 描述 | 可否为空 |
|---|---|---|
| content | 被替换的字符串 | 否 |
| regx | 正则表达式 | 否 |
| target | 替换字符串 | 否 |
TIP
返回值类型:String
正则替换第一个字符串
把
h1e2l3l4o5替换成he2l3l4o5
${string.replaceFirst('h1e2l3l4o5','\\d+','')}length
| 参数名 | 描述 | 可否为空 |
|---|---|---|
| content | 要获取长度的字符串 | 否 |
TIP
返回值类型:int
获取字符串的长度
获取
hello的长度
${string.length('hello')}trim
| 参数名 | 描述 | 可否为空 |
|---|---|---|
| content | 要去除前后空格的字符串 | 否 |
TIP
返回值类型:String
去除前后空格
split
| 参数名 | 描述 | 可否为空 |
|---|---|---|
| content | 被替换的字符串 | 否 |
| regx | 正则表达式 | 否 |
TIP
返回值类型:String
正则分割字符串
把
h1e2l3l4o5替换成['h','e','l','l','o']
${string.split('h1e2l3l4o5','\\d+')}bytes
| 参数名 | 描述 | 可否为空 |
|---|---|---|
| content | 被替换的字符串 | 否 |
| charset | 编码格式 | 是 |
TIP
返回值类型:byte[]
获取字符串的字节数组
获取字符串
hello的字节数组
${string.bytes('hello')}newString
| 参数名 | 描述 | 可否为空 |
|---|---|---|
| byte[] | 字节数组 | 否 |
| charset | 编码格式 | 否 |
TIP
返回值类型:String
把字节数组转为String
${string.newString(resp.bytes)}equals
| 参数名 | 描述 | 可否为空 |
|---|---|---|
| str1 | 字符串1 | 否 |
| str2 | 字符串2 | 否 |
TIP
返回值类型:String
判断两个字符串是否相同
${string.equals(resp.html,'hello,world')}uuid
TIP
返回值类型:String
获取一个UUID字符串
${string.uuid()}uuids
| 参数名 | 描述 | 可否为空 |
|---|---|---|
| size | 要获取uuid的数量 | 否 |
TIP
返回值类型:List<String>
获取10个uuid
${string.uuids(10)}