<%@ LANGUAGE="VBSCRIPT" %>
<% Response.Buffer = "True"
'Developed by Chee.ky Studios for public use via 4GuysFromRolla.com
'fl1rt@chee.ky
%>
<%
'replace this string content
myStr = "Ms.Chicken was beginning to feel some what queezy as she piggy-backed on the farm sheep dog.
The Cat and horse just looked at other."
'display example
Response.write "Normal String:
" & myStr
Response.write "
"
Response.write "Censored String:
" & CensorStr(myStr)
Function CensorStr(NaughtyString)
'this array defines the words to look for and what to replace the word with if found.
ExpletivesBAD = Array("cat","chicken","dog","horse","pig")
ExpletivesCEN = Array("c*t","c*****n","d*g","h**se","#!#")
TotalExpletives = ubound(expletivesBAD)
for i = 0 to TotalExpletives
CENSOR = InStr(1, NaughtyString, ExpletivesBAD(i), 1)
if CInt(CENSOR) > 0 then
NaughtyString = replace(NaughtyString," " & ExpletivesBAD(i)," " & ExpletivesCEN(i),1,-1,1)
NaughtyString = replace(NaughtyString,ExpletivesBAD(i) & " ",ExpletivesCEN(i) & " ",1,-1,1)
end if
next
CensorStr = NaughtyString
End Function
Dim str
str = "Concatenation is fun"
Response.Write str & "
" & CensorStr(str)
%>