Replace() Function example in ASP
Replace(variable, searchfor, replacewith)
In this code segment, the word "off" is replaced by the word "around" wherever it is found in the text string stored in the variable cTest.
The result can be stored in a new variable or in the original variable.
<% 'BEGIN ASP SCRIPT
Dim cTest, cNew 'Initialize a couple of 'Character variables
cTest = "Just showing off the replace statement"
cNew = Replace(cTest, "off", "around")
<!–END ASP SCRIPT ––>
The new value is <%=cNew%>.
The output of this code segment would be:
The new value is Just showing around the replace statement.