Excessive code in the IMG of an ASP replacement function

Source: Internet
Author: User

<%
Response. write (server. htmlencode (fiximg (" screen. width-461) window. open ('qq/20082181405371.jpg '); "" alt = "border =" "0" "src =" "QQ/20082181405371.jpg""/> ")))
%>
<%
'Function: Change the img Code Format to .
Function fiximg (sstring)

Dim sreallydo, RegEx, ireallydo
Dim omatches, cmatch
Dim tstarttime, tendtime
If isnull (sstring) then
Fiximg = ""
Exit Function
End if
Sreallydo = sstring
On Error resume next
Sreallydo = Replace (sreallydo, vbcr ,"")
Sreallydo = Replace (sreallydo, vblf ,"")
Sreallydo = Replace (sreallydo, vbtab ,"")
Sreallydo = Replace (sreallydo, "Sreallydo = Replace (sreallydo, "/>", "/>", 1,-1, 1)
Sreallydo = replaceall (sreallydo, "=", "=", true)
Sreallydo = replaceall (sreallydo, ">", ">", true)
Sreallydo = Replace (sreallydo, "> <", ">" & vbcrlf & "<")
Sreallydo = trim (sreallydo)
On Error goto 0
Set RegEx = new Regexp
RegEx. ignorecase = true
RegEx. Global = true
'// Remove the onclick, onload, and other scripts
RegEx. pattern = "\ s [on]. +? = ([\ "" | \ ']) (. *?) \ 1"
Sreallydo = RegEx. Replace (sreallydo ,"")
'// Enclose the image address of SRC without quotation marks with quotation marks
RegEx. pattern = "] *). *?> "
Sreallydo = RegEx. Replace (sreallydo, " ")
'// The SRC address of the matching image
RegEx. pattern = " "
Sreallydo = RegEx. Replace (sreallydo, " ")
Fiximg = sreallydo
End Function
%>
<%
'Function: return a string, in which a specified number of substrings are replaced with another substring.
'Source: http://jorkin.reallydo.com/article.asp? Id = 406
'Need bint function: http://jorkin.reallydo.com/article.asp? Id = 395

Function replaceall (sexpression, Sfind, sreplacewith, ball)
If isnull (sexpression) Then replaceall = "": Exit Function
If (strcomp (ball, "true", 1) = 0) or (cbool (bint (ball) = true) then
Do While instr (1, sexpression, Sfind, 1)> 0
Sexpression = Replace (sexpression, Sfind, sreplacewith, 1,-1, 1)
If instr (1, sreplacewith, Sfind, 1)> 0 Then exit do
Loop
Else
Do While instr (sexpression, Sfind)> 0
Sexpression = Replace (sexpression, Sfind, sreplacewith)
If instr (sreplacewith, Sfind)> 0 Then exit do
Loop
End if
Replaceall = sexpression
End Function
%>
<%
'Function: only numbers are allowed.
'Source: http://jorkin.reallydo.com/article.asp? Id = 395

function bint (STR)
STR = trim (STR)
If STR = "" Or isnull (STR) or not isnumeric (STR) then STR = "0"
bint = round (STR, 0)
end function
%>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.