String Replace in Classic ASP!

Do you wonder how to do a String Replace in Classic ASP?. Inbuilt Classic ASP function ‘Replace’ is there to help for you!.
Replace is a classic ASP function that helps us to replace the character of a string using another character.

Below is the example showing how you can replace a character from a String:

<%

origtext    = "hot"
replacetext = Replace(origtext,"o","a")
print "hot becomes "&replacetext

%>

Output for the above program is ‘hot becomes hat’.

Also, you can replace an entire string with the same function. Have a look at the below example:

<%

origtext    = "I want to buy a Bike"
replacetext = Replace(origtext,"Bike","Car")
print replacetext

%>

Output for the above program is : I want to buy a Car

One thought on “String Replace in Classic ASP!

Leave a Reply

Theme: Overlay by Kaira
Agurchand