$substitute()
DESCRIPTION in a string, replace a substring with another substring at the specified instance of the first substring or: in a string, replace every instance of a substring with another substring
SYNOPSIS
$substitute(s1,s2,s3,i)
or:
$substitute(s1,s2,s3)
ARGUMENTS
s1 - a quoted string, or string expression
s2 - a quoted string, or string expression
s3 - a quoted string, or string expression
i - a positive integer, or integer expression, greater than or equal to one
or:
s1 - a quoted string, or string expression
s2 - a quoted string, or string expression
s3 - a quoted string, or string expression
EXAMPLES
# pikt +C 'output $substitute("she loves me yeah yeah yeah","yeah","no",1)'
she loves me no yeah yeah
# pikt +C 'output $substitute("she loves me yeah yeah yeah","yeah","no",2)'
she loves me yeah no yeah
# pikt +C 'output $substitute("she loves me yeah yeah yeah","yeah","no",3)'
she loves me yeah yeah no
# pikt +C 'output $substitute("she loves me yeah yeah yeah","yeah","no",4)'
she loves me yeah yeah yeah
# pikt +C 'output $substitute("she loves me yeah yeah yeah","yeah","no")'
she loves me no no no
# pikt +C 'output $substitute("she loves me yeah yeah yeah","yeah","")'
she loves me
# pikt +C 'output $substitute($substitute("she loves me yeah yeah yeah","yeah",""),"loves","hates",1)'
she hates me
SEE ALSO
$replace()
String Functions
Numerical Functions