replace - replace a character or substring in a string

Return to Introduction  Previous page  Next page

replace  $variable,oldString,newString

Where:

$variablevariable containing text to be replaced..
oldStringthe string to replaced. Enclose oldString in double quotation marks ("") if it contains embedded spaces or commas.
newStringthe replacement string. Enclose newString in double quotation marks ("") if it contains embedded spaces or commas.        

 

 

oldString and newString may be variables.

The replace command replaces all occurrences of oldString in $variable with newString.

Example

replace$variable,dog,cat

 

Sample Script

* replace.txt

* replace fox with dog

 

SetVar $Result,"The quick brown fox"

SetVar $Old,"fox"

SetVar $New,"dog"

replace $Result,$Old,$New

type $Result

exit


TN3270 Plus is continually being improved. To learn more about the latest enhancements, please review our Version History web page.