replace 函数

语法

  • string replace(inputString, oldString, newString)

参数

  1. inputStringstring
  2. oldStringstring
  3. newString—(float, bool, string)

返回

inputString 的副本,其中 oldString 替换为 newString

描述

replace 函数用于将 oldStringinputString 中的所有出现替换为 newString

相关内容

示例

replace("rule your city with cityengine","your city","designs")
# result = "rule designs with cityengine"
replace("myTexture.#.jpg","#","1")
# result = "myTexture.1.jpg"
# this example is e.g. useful for index-based texturing