Table of Contents

strreplace

Description

Replace a substring of text within a string with another substring.

Function prototype

string strreplace <string:Text> <string:Old> <string:New>

Arguments

Name Type Comment
Text string A string, a substring of which is to be replaced.
Old string A substring of Text that is to be replaced.
New string A string that is to replace Old within Text.

Return value

A string containing Text with all instances of Old replaced by New.

Example

// replace "test" in "this is a test" with "awesome"

echo <strreplace "This is a test" "test" "awesome">

… the output of which is written to the event log by echo as:

This is awesome

Comments

None.

See also