function htmlencode
dim result
dim l
if isNULL(str) then
htmlencode
exit function
End if
l=len(str)
result=""
dim i
for i =
select case mid(str
case "<"
result=result+"<"
case ">"
result=result+">"
case chr(
result=result+"""
case "&"
result=result+"&"
case chr(
result=result+" "
if i+
if mid(str
result=result+" "
else
result=result+" "
End if
else
result=result+" "
End if
case chr(
result=result+" "
case else
result=result+mid(str
End select
next
htmlencode
End function
}
From:http://tw.wingwit.com/Article/program/net/201311/14021.html