📄 functions_filters.asp
字号:
'then repleace <br /> tags with carridge returns that get changed back to <br /> tags once
'the HTML has been striped
'If leaving in <br /> tags
If blnRemoveBRtags = false Then
'Remove null chars from string before the next step
strMessageInput = Replace(strMessageInput, vbNullChar, "", 1, -1, 1)
'Change <br /> tags into nulls so they are not striped and can be changed back later
strMessageInput = Replace(strMessageInput, "<br />", vbNullChar, 1, -1, 1)
strMessageInput = Replace(strMessageInput, "<br>", vbNullChar, 1, -1, 1)
End If
'Create regular experssions object
Set objRegExp = New RegExp
'Tell the regular experssions object to look for tags <xxxx>
With objRegExp
.Pattern = "<[^>]+>"
.IgnoreCase = True
.Global = True
End With
'Strip HTML
strMessageInput = objRegExp.Replace(strMessageInput, "")
'Tell the regular experssions object to look for BB forum codes [xxxx]
With objRegExp
.Pattern = "\[[^\]]+\]"
.IgnoreCase = True
.Global = True
End With
'Strip BB forum codes
strMessageInput = objRegExp.Replace(strMessageInput, "")
'Distroy regular experssions object
Set objRegExp = nothing
'Replace a few characters in the remaining text
strMessageInput = Replace(strMessageInput, "<", "<", 1, -1, 1)
strMessageInput = Replace(strMessageInput, ">", ">", 1, -1, 1)
strMessageInput = Replace(strMessageInput, "'", "'", 1, -1, 1)
strMessageInput = Replace(strMessageInput, """", """, 1, -1, 1)
strMessageInput = Replace(strMessageInput, " ", "", 1, -1, 1)
'If the length of the text is longer than the max then cut it and place '...' at the end
strMessageInput = TrimString(strMessageInput, lngReturnLength)
'Remove new lines as it's better for display as link titles
strMessageInput = Replace(strMessageInput, vbCrLf, " ", 1, -1, 1)
'Place back in <br /> tags
If blnRemoveBRtags = false Then strMessageInput = Replace(strMessageInput, vbNullChar, vbCrLf & " <br />", 1, -1, 1)
'Return the function
removeHTML = strMessageInput
End Function
'*********************************************
'*** Decode HTML encoding for plain text *****
'*********************************************
'Decode encoded strings
Private Function decodeString(ByVal strInputEntry)
'Prevent errors
If isNull(strInputEntry) Then strInputEntry = ""
'Decode HTML character entities
strInputEntry = Replace(strInputEntry, "A", "A", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "B", "B", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "C", "C", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "D", "D", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "E", "E", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "F", "F", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "G", "G", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "H", "H", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "I", "I", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "J", "J", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "K", "K", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "L", "L", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "M", "M", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "N", "N", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "O", "O", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "P", "P", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "Q", "Q", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "R", "R", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "S", "S", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "T", "T", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "U", "U", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "V", "V", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "W", "W", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "X", "X", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "Y", "Y", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "Z", "Z", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "a", "a", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "b", "b", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "c", "c", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "d", "d", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "e", "e", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "f", "f", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "g", "g", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "h", "h", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "i", "i", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "j", "j", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "k", "k", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "l", "l", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "m", "m", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "n", "n", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "o", "o", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "p", "p", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "q", "q", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "r", "r", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "s", "s", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "t", "t", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "u", "u", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "v", "v", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "w", "w", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "x", "x", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "y", "y", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "z", "z", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "0", "0", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "1", "1", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "2", "2", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "3", "3", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "4", "4", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "5", "5", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "6", "6", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "7", "7", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "8", "8", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "9", "9", 1, -1, 0)
'Non aplha numeric characters
strInputEntry = Replace(strInputEntry, "&", "&", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "'", "'", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "'", "'", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "=", "=", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "=", "=", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "[", "[", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "[", "[", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "\", "\", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "\", "\", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "]", "]", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "]", "]", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "’", "'", 1, -1, 1)
'Decode other entities
strInputEntry = Replace(strInputEntry, "&", "&", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "<", "<", 1, -1, 1)
strInputEntry = Replace(strInputEntry, ">", ">", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "'", "'", 1, -1, 1)
strInputEntry = Replace(strInputEntry, """, """", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "\", "\", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "[", "[", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "]", "]", 1, -1, 1)
'Return
decodeString = strInputEntry
End Function
'*********************************************
'*** Remove HTML encoding *****
'*********************************************
'Remove HTML encoding of ASCII characters A-z 0-10
Private Function removeHTMLencoding(ByVal strInputEntry)
'Prevent errors
If isNull(strInputEntry) Then strInputEntry = ""
'Decode HTML character entities
strInputEntry = Replace(strInputEntry, "A", "A", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "B", "B", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "C", "C", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "D", "D", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "E", "E", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "F", "F", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "G", "G", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "H", "H", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "I", "I", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "J", "J", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "K", "K", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "L", "L", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "M", "M", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "N", "N", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "O", "O", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "P", "P", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "Q", "Q", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "R", "R", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "S", "S", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "T", "T", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "U", "U", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "V", "V", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "W", "W", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "X", "X", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "Y", "Y", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "Z", "Z", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "a", "a", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "b", "b", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "c", "c", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "d", "d", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "e", "e", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "f", "f", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "g", "g", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "h", "h", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "i", "i", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "j", "j", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "k", "k", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "l", "l", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "m", "m", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "n", "n", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "o", "o", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "p", "p", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "q", "q", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "r", "r", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "s", "s", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "t", "t", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "u", "u", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "v", "v", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "w", "w", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "x", "x", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "y", "y", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "z", "z", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "0", "0", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "1", "1", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "2", "2", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "3", "3", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "4", "4", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "5", "5", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "6", "6", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "7", "7", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "8", "8", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "9", "9", 1, -1, 0)
'Repeat with 0
strInputEntry = Replace(strInputEntry, "A", "A", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "B", "B", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "C", "C", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "D", "D", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "E", "E", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "F", "F", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "G", "G", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "H", "H", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "I", "I", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "J", "J", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "K", "K", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "L", "L", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "M", "M", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "N", "N", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "O", "O", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "P", "P", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "Q", "Q", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "R", "R", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "S", "S", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "T", "T", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "U", "U", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "V", "V", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "W", "W", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "X", "X", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "Y", "Y", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "Z", "Z", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "a", "a", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "b", "b", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "c", "c", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "0", "0", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "1", "1", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "2", "2", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "3", "3", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "4", "4", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "5", "5", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "6", "6", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "7", "7", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "8", "8", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "9", "9", 1, -1, 0)
'Return
removeHTMLencoding = strInputEntry
End Function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -