DriveWorks Solo 15: Substitute [send feedback...]

Syntax

SUBSTITUTE( [ TextToSearchIn], [ OriginalText], [ ReplacementText], [ InstanceNumber], [ IgnoreCase] )

This function searches through a main string value for a specified string, and replaces the numbered instance of that found value with the replacement text specified.

TextToSearchIn is the main string value that the specified instance is to be replaced in.

OriginalText is the string instance to be found and replaced within the main string value.

ReplacementText is the string that the user would like to replace the OriginalText value with.

InstanceNumber is the occurrence number of the OriginalText string found that is to be replaced. If this is left blank, then the function will replace the first instance by default. If no occurrence is found, or if there are less instances than the number specified, then the text will remain unchanged.

IgnoreCase set to TRUE will substitute all instances of the text, ignoring upper case and lower case.

Examples

Rule

Meaning
SUBSTITUTE("My name is Joe", "Joe", "Fred", 1,TRUE)The function searches the string "My name is Joe" and finds the first instance (defined by the numerical value of 1 as the final parameter) of the value "Joe", and replaces it with the string "Fred". The result in this case would be: "My name is Fred".
SUBSTITUTE("My name is Joe and his name is Joe", "Joe", "Fred", 2, TRUE)The function searches the string "My name is Joe and his name is Fred" and finds the second instance (defined by the numerical value of 2 as the final parameter) of the value "Joe", and replaces it with the string "Fred". The result in this case would be: "My name is Joe and his name is Fred".

Table of Contents