ASP Hosting sale!
1,000MB space, 40GB transfer, 1 SQL Server 2000 db! - $9.95 per month*!
Limited Time Offer!

aspdev | articles | tutorials | forums

ASPdev -> ASP Articles -> ASP Replace() function

ASP Replace() function

The ASP Replace() (if we want to be correct the Replace() function is a VBScript function) is a handy function, used to replace sub-strings found within a string.

The VBScript Replace() function has 3 mandatory arguments. The first one is the string to be searched. The second argument is the sub-string you are searching for within the first argument. The third one is the string that will replace the second argument into the searched string (first argument).

Have a look at the following ASP code:

<%

sMyString = "Who-was-that?"
sMyString = Replace(sMyString, "-", " ")

Response.Write sMyString

%>

The code above will search our sMyString and will replace all dashes with " " (single white space). The result of the code above will look like this:

Who was that?




Contact Us