In the previous article ASP Vbscript Replace function we learnt about the syntax and replace function parameters that allow you to use the function in different ways. First three parameters of vbscript replace string function provide the functionality to replace all the occurrences of specified string pattern with other string or character in classic ASP web pages. 4th parameter start specifies the starting index for the replace function that performs the replace action on the substring string starting from the specified start parameter value. If start parameter is specified in the replace function then it returns the substring starting replaced with new string pattern or character from the specified start index value. 5th parameter count specifies to perform the replace action or replacement of old string with new one only for specified times. Now let’s see with the help of examples.
Example 1:
<%
myString = "Vbscript Replace String Function"
' vbscript replace specified with 3 required parameters such as string expression, find string and replacement string value
%>
Output:
VbscrIpt Replace StrIng FunctIon
Example 2:
' here optional parameter start is passed and value has been evaluated by used InStr function by finding the first indexof white space character +1.
Replace StrIng FunctIon
Example 3:
' Optional parameters start and count are specified here where start = 1 and count = 1. Vbscript replace function will replace only first occurence of specified character.
VbscrIpt Replace String Function
Be the first to rate this post
Tags: vbscript, asp, vbscript replace, vbscript string functions, vbscript right, vbscript instrrev, vbscript mid, vbscript replace string function, vbscript trim, vbscript ltrim, vbscript rtrim, vbscript left, vbscript instr, vbscript lcase, vbscript replace function examples, vbscript ucase, vbscript len, vbscript strreverse, vbscript strcomp, vbscript space, vbscript string function
8/23/2008 8:40:28 PM