<%
'*************************************** ***********
'Function name: gotTopic
'Usage: String truncation. One Chinese character is counted as two characters, and one English character is counted as one character.
'Parameter: str ---- original string
'Strlen ---- truncation Length
'Return value: the intercepted string
'*************************************** ***********
Function gotTopic (str, strlen)
If str = "" then
GotTopic = ""
Exit function
End if
Dim l, t, c, I
Str = replace (str, "", ""), ", chr (34),"> ","> "), "<", "<")
Str = replace (str ,"? ","")
L = len (str)
T = 0
For I = 1 to l
C = Abs (Asc (Mid (str, I, 1 )))
If c & gt; 255 then
T = t + 2
Else
T = t + 1
End if
If t> = strlen then
GotTopic = left (str, I )&"... "
Exit
Else
GotTopic = str
End if
Next
GotTopic = replace (gotTopic, "", ""), chr (34), "),"> ","> "), "<", "<")
End function
'================================================ ============================
'Function: RemoveHTML (strHTML)
'Function: Remove HTML tags
'Parameter: strHTML -- string to remove HTML tags
'================================================ ============================
Function RemoveHTML (strHTML)
Dim objRegExp, Match, Matches
Set objRegExp = New Regexp
ObjRegExp. IgnoreCase = True
ObjRegExp. Global = True
'Take the closed <>
ObjRegExp. Pattern = "<. +?> "
'For matching
Set Matches = objRegExp. Execute (strHTML)
'Traverse the matching set and replace the matched items.
For Each Match in Matches
StrHtml = Replace (strHTML, Match. Value ,"")
Next
RemoveHTML = strHTML
Set objRegExp = Nothing
Set Matches = nothing
End Function
%>