Velocity Reviews > good swear word filter?

# good swear word filter?

Lord Merlin
Guest
Posts: n/a

 07-05-2004
my current one?

This is the code I have currently, but it doesn't always work. I can do the
same test, with the same word 4/5/6/7 times in a row, and sometimes it
works, sometimes not.

================================================== ==========
arrcheck(0) = "god"
arrcheck(1) = "jesus"
arrcheck(2) = "fart"
..................
...................
arrcheck(72) = "arse"
arrcheck(73) = "crap"

strsubject = " " & GetFormData("strsubject") & " "
incident = " " & GetFormData("incident") & " "
solution = " " & GetFormData("solution") & " "

'--------SWEAR FILTER-----------------
For Each tWord in arrCheck
tWord=UCASE(tWord)
strsubject = Replace(strsubject," " & tWord & " "," *** ",1,-1,1)
strsubject = Replace(strsubject," " & tWord & "."," *** ",1,-1,1)
strsubject = Replace(strsubject," " & tWord & "!"," *** ",1,-1,1)
strsubject = Replace(strsubject," " & tWord & "?"," *** ",1,-1,1)
strsubject = Replace(strsubject," " & tWord & "-"," *** ",1,-1,1)
strsubject = Replace(strsubject," " & tWord & ","," *** ",1,-1,1)
strsubject = Replace(strsubject," " & tWord & "_"," *** ",1,-1,1)
strsubject = Replace(strsubject," " & tWord & "/"," *** ",1,-1,1)
strsubject = Replace(strsubject," " & tWord & "&"," *** ",1,-1,1)
strsubject = Replace(strsubject," " & tWord & "@"," *** ",1,-1,1)
strsubject = Replace(strsubject," " & tWord & "@"," *** ",1,-1,1)
Next
For Each tWord in arrCheck
tWord=UCASE(tWord)
incident = Replace(incident," " & tWord & " "," *** ",1,-1,1)
incident = Replace(incident," " & tWord & "."," *** ",1,-1,1)
incident = Replace(incident," " & tWord & "!"," *** ",1,-1,1)
incident = Replace(incident," " & tWord & "?"," *** ",1,-1,1)
incident = Replace(incident," " & tWord & "-"," *** ",1,-1,1)
incident = Replace(incident," " & tWord & ","," *** ",1,-1,1)
incident = Replace(incident," " & tWord & "_"," *** ",1,-1,1)
incident = Replace(incident," " & tWord & "/"," *** ",1,-1,1)
incident = Replace(incident," " & tWord & "&"," *** ",1,-1,1)
incident = Replace(incident," " & tWord & "@"," *** ",1,-1,1)
Next
For Each tWord in arrCheck
tWord=UCASE(tWord)
solution = Replace(solution," " & tWord & " "," *** ",1,-1,1)
solution = Replace(solution," " & tWord & "."," *** ",1,-1,1)
solution = Replace(solution," " & tWord & "!"," *** ",1,-1,1)
solution = Replace(solution," " & tWord & "?"," *** ",1,-1,1)
solution = Replace(solution," " & tWord & "-"," *** ",1,-1,1)
solution = Replace(solution," " & tWord & ","," *** ",1,-1,1)
solution = Replace(solution," " & tWord & "_"," *** ",1,-1,1)
solution = Replace(solution," " & tWord & "/"," *** ",1,-1,1)
solution = Replace(solution," " & tWord & "&"," *** ",1,-1,1)
solution = Replace(solution," " & tWord & "@"," *** ",1,-1,1)
Next

'/--------SWEAR FILTER-----------------

strsubject = Trim(strsubject )
incident = Trim(incident )
solution = Trim(solution )

================================================== ==========

your help in this matter will be greatly appreciated
--

Kind Regards
Rudi Ahlers
+27 (82) 926 1689

Greater love has no one than this, that he lay down his life for his friends
(John 15:13).

Jeff Cochran
Guest
Posts: n/a

 07-06-2004
On Mon, 5 Jul 2004 22:22:56 +0200, "Lord Merlin"
<(E-Mail Removed)_SPAM> wrote:

>my current one?
>
>
>This is the code I have currently, but it doesn't always work. I can do the
>same test, with the same word 4/5/6/7 times in a row, and sometimes it
>works, sometimes not.

Perhaps if we had an idea of what "sometimes works" actually meant in
terms of input, output, expected results, received results, error
messages and so on...

Jeff

>================================================= ===========
> arrcheck(0) = "god"
> arrcheck(1) = "jesus"
> arrcheck(2) = "fart"
>.................
>..................
> arrcheck(72) = "arse"
> arrcheck(73) = "crap"
>
>
> strsubject = " " & GetFormData("strsubject") & " "
> incident = " " & GetFormData("incident") & " "
> solution = " " & GetFormData("solution") & " "
>
>
> '--------SWEAR FILTER-----------------
> For Each tWord in arrCheck
> tWord=UCASE(tWord)
> strsubject = Replace(strsubject," " & tWord & " "," *** ",1,-1,1)
> strsubject = Replace(strsubject," " & tWord & "."," *** ",1,-1,1)
> strsubject = Replace(strsubject," " & tWord & "!"," *** ",1,-1,1)
> strsubject = Replace(strsubject," " & tWord & "?"," *** ",1,-1,1)
> strsubject = Replace(strsubject," " & tWord & "-"," *** ",1,-1,1)
> strsubject = Replace(strsubject," " & tWord & ","," *** ",1,-1,1)
> strsubject = Replace(strsubject," " & tWord & "_"," *** ",1,-1,1)
> strsubject = Replace(strsubject," " & tWord & "/"," *** ",1,-1,1)
> strsubject = Replace(strsubject," " & tWord & "&"," *** ",1,-1,1)
> strsubject = Replace(strsubject," " & tWord & "@"," *** ",1,-1,1)
> strsubject = Replace(strsubject," " & tWord & "@"," *** ",1,-1,1)
> Next
> For Each tWord in arrCheck
> tWord=UCASE(tWord)
> incident = Replace(incident," " & tWord & " "," *** ",1,-1,1)
> incident = Replace(incident," " & tWord & "."," *** ",1,-1,1)
> incident = Replace(incident," " & tWord & "!"," *** ",1,-1,1)
> incident = Replace(incident," " & tWord & "?"," *** ",1,-1,1)
> incident = Replace(incident," " & tWord & "-"," *** ",1,-1,1)
> incident = Replace(incident," " & tWord & ","," *** ",1,-1,1)
> incident = Replace(incident," " & tWord & "_"," *** ",1,-1,1)
> incident = Replace(incident," " & tWord & "/"," *** ",1,-1,1)
> incident = Replace(incident," " & tWord & "&"," *** ",1,-1,1)
> incident = Replace(incident," " & tWord & "@"," *** ",1,-1,1)
> Next
> For Each tWord in arrCheck
> tWord=UCASE(tWord)
> solution = Replace(solution," " & tWord & " "," *** ",1,-1,1)
> solution = Replace(solution," " & tWord & "."," *** ",1,-1,1)
> solution = Replace(solution," " & tWord & "!"," *** ",1,-1,1)
> solution = Replace(solution," " & tWord & "?"," *** ",1,-1,1)
> solution = Replace(solution," " & tWord & "-"," *** ",1,-1,1)
> solution = Replace(solution," " & tWord & ","," *** ",1,-1,1)
> solution = Replace(solution," " & tWord & "_"," *** ",1,-1,1)
> solution = Replace(solution," " & tWord & "/"," *** ",1,-1,1)
> solution = Replace(solution," " & tWord & "&"," *** ",1,-1,1)
> solution = Replace(solution," " & tWord & "@"," *** ",1,-1,1)
> Next
>
> '/--------SWEAR FILTER-----------------
>
> strsubject = Trim(strsubject )
> incident = Trim(incident )
> solution = Trim(solution )
>
>
>
>================================================= ===========
>
>your help in this matter will be greatly appreciated