eWebProgrammer eweb

ASP   «Prev 

Replace() Function example in ASP

Essential syntax:
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.
  Dim cTest, cNew 'Initialize a couple of 'Character variables 
  cTest = "Just showing off the replace statement"
  cNew = Replace(cTest, "off", "around")
  The new value is <%=cNew%>.

The output of this code segment would be:
The new value is Just showing around the replace statement.