Substitute Strings [SUBSTITUTE]

Replaces a string with another string, in the specified instance (or all instances).

Syntax

SUBSTITUTE (“Text”, “OldText”, “NewText”, [InstanceIndex])

Note: The required separator (comma or semi-colon) automatically corresponds to your computer’s location settings.

Data Types of the Arguments

All Texts: String

InstanceIndex (Optional): Integer

If InstanceIndex value is omitted, then all instances of the OldText are replaced.

Data Type of the Result

String

Example

A Wall’s “Brick dimensions” Property is a string: “92mm x 57 mm x 194 mm”.

Use SUBSTITUTE to extract just the numbers from this string (e.g. for use in another expression).

(For the OldText “mm” strings, substitute a NewText of nothing.)

Expression

SUBSTITUTE (Brick Dimensions, “mm”, “”)

The InstanceIndex is not provided. Thus, all instances of the OldText will be substituted.

Result

92 x 57 x 194

Notes

Use SUBSTITUTE to replace one string with another, in all instances or a particular instance.

Use Replace in String [REPLACE] to change a particular string to another string, with a given starting position.

  • Was this Helpful ?
  • YesNo