replace function

This 2021.0 documentation has been archived and is no longer updated. Content and links may be outdated. See the latest documentation.

Syntax

  • string replace(inputString, oldString, newString)

Parameters

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

Returns

Copy of inputString with oldString replaced by newString.

Description

The replace function replaces all occurrences of the oldString inside the inputString with the newString.

Related

Examples

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

In this topic