- OpenTofu 语言
- 函数
- trim
trim
函数
trim
从给定字符串的开头和结尾删除指定的字符集。
trim(string, str_character_set)
第二个参数中的每个字符都会从第一个参数中指定的字符串的开头和结尾删除。
示例
> trim("?!hello?!", "!?")
"hello"
> trim("foobar", "far")
"oob"
> trim(" hello! world.! ", "! ")
"hello! world."
相关函数
trimprefix
从字符串开头删除一个单词。trimsuffix
从字符串结尾删除一个单词。trimspace
从字符串开头和结尾删除所有类型的空格。