HomeASP HostingWeb DesignRegister DomainSupportAbout Us

FAQ
Support :: FAQ


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 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).

Consider the following ASP code:

<%

sMyString = "What-are-the-lottery-numbers-this-week?"
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:

What are the lottery numbers this week?
© Copyright 2001-2004 Art Branch Inc.