3 回答
TA贡献1794条经验 获得超8个赞
<%
function rp(string)
dim str
str=replace(string,chr(34),"&quot;")
str=replace(str,chr(38),"&amp;")
str=replace(str,chr(39),"&#39;")
str=replace(str,"<","&lt;")
str=replace(str,">","&gt;")
str=replace(str,chr(32),"&nbsp;")
str=replace(str,chr(10),"<br>")
str=replace(str,chr(13),"")
rp=str
end function
function nrp(string)
dim str
str=replace(string,"&quot;",chr(34))
str=replace(str,"&#39;",chr(39))
str=replace(str,"&lt;","<")
str=replace(str,"&gt;",">")
str=replace(str,"&nbsp;",chr(32))
str=replace(str,"<br>",chr(13)&chr(10))
str=replace(str,"&amp;",chr(38))'注意这一句必须放在最后,否则就像楼上的那样,会出现意想不到的结果?
nrp=str
end function
%>
把以上的&符号替换为英文状态下的&
TA贡献1815条经验 获得超10个赞
Function rp(s)
Dim t
t = Replace(s, "&", "&")
t = Replace(t, "<", "<")
t = Replace(t, ">", ">")
t = Replace(t, " ", " ")
t = Replace(t, vbcrlf, "<br>") '这个是Windows换行符,vbcrlf
rp = t
End Function
Function nrp(s)
Dim t
t = Replace(s, "&", "&")
t = Replace(t, "<", "<")
t = Replace(t, ">", ">")
t = Replace(t, " ", " ")
t = Replace(t, "<br>", vbcrlf)
nrp = t
End Function
添加回答
举报