MathTop

substitute_string 函数

替换子串的第一次出现。

语法

  • StringTools:-Substitute(text, old, new)
  • substitute_string(text, old, new)

参数与选项

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

示例

  1. 首次替换StringTools:-Substitute('a-b-a', 'a', 'x')返回 x-b-a。