资源编排服务 RFS-常见函数:字符串函数

时间:2024-04-18 10:02:52

字符串函数

表1 字符串函数

函数名称

函数描述

样例

运行结果

format

字符串格式化

format("Hello, %s!", "cloud")

Hello, cloud!

lower

将字符串中的字母转换为小写

lower("HELLO")

hello

upper

将字符串中的字母转换为大写

upper("hello")

HELLO

join

使用自定义字符将列表拼接成字符串

join(", ", ["One", "Two", "Three"])

One, Two, Three

split

根据分隔符拆分字符串

split(", ", "One, Two, Three")

["One", "Two", "Three"]

substr

通过偏移量和长度从给定的字符串中提取一个子串

substr("hello world!", 1, 4)

ello

replace

把字符串中的str1替换成str2

replace("hello, cloud!", "h", "H")

Hello, cloud!

support.huaweicloud.com/tr-aos/rf_05_0006.html