MathTop

replace_string 函数

将一个子串的每次出现都替换为另一个子串。

语法

  • replace_string(text, old, new)
  • string_replace(text, old, new)

参数与选项

text文本值,通常写在引号中。
old要替换的子串。
new替换后的文本。

示例

  1. 替换全部匹配项replace_string('a-b-a', 'a', 'x')返回 x-b-x。