Title=replace (title, "DF", "SD", 1,-1,1)
Replace function parameter detailed:
Parameter 1: source string
Parameter 2: The character to be replaced
Parameter 3: New characters
Parameter 4: value 1, specifies that the string should be searched starting from the first character
Parameter 5: The value is-1 specifies that each substring is to be replaced
Parameter 6: A value of 1 specifies that comparisons of strings are case-insensitive.
Replace in VBScript () Details:
Function: Finds in a string, substituting the specified string.
Format: replace (Strtobesearched,strsearchfor,strreplacewith [, Start[,count[,compare]]])
Parameter: strtobesearched is a string; strSearchFor is the substring being looked for; strReplaceWith is the substring to be substituted. Start,count,compare is any option.
Example:
The code is as follows |
Copy Code |
<% Strtest= "This is an apple." Response.Write Replace (strtest, "Apple", "orange") %> |
Instance
The next one is to replace "'" for ""
The code is as follows |
Copy Code |
Function Strreplace (STR) Dim tempcheckstr Tempcheckstr=str If Isnull (TEMPCHECKSTR) Then Strreplace = ""//here to register, if the string is empty, the replace will be wrong Exit Function End If Strreplace = Replace (Tempcheckstr, "'", "") End Function |
Here is a link to the keyword
The code is as follows |
Copy Code |
function Insertlink (Str,key,url) If str<> "" Then Str=replace (Str,key, "<a href=" &url& ">" &key& "</a>" End If Insertlink=str End Function |
ASP uses the replace of regular expressions
The code is as follows |
Copy Code |
Set regEx = New RegExp Regex.pattern = Reg ' Regular expression Regex.ignorecase = True ' Ignore case Regex.global = True Newstr= regex.replace (Oldstr,newpart) ' Reg is replaced with Newpart Set regEx = Nothing |
Replace replace ignore case
Replace (expression, find, replacewith[, start[, count[, compare]]) principle above, count refers to the number of replacements,-1 to replace all