• Welcome to Valhalla Legends Archive.
 

Reversing ProfanityUnfilter

Started by haZe, January 11, 2003, 01:57 AM

Previous topic - Next topic

haZe

OK. I reversed the profanityunfilter option on EB successfully, but I need it to recognize it as fUcK instead of just fuck or FUCK. how can I make it do that? this is what I have now.
Public Function ProfanityUnfilter(strMessage As String) As String
If InStr(strMessage, "fuck") <> 0 Then strMessage = Replace(strMessage, "fuck", "!$%!")
ProfanityUnfilter = strMessage
End Function
thats only an example of 1 line of the swear words, tho. But how can I do it without typing fuck every single way in vb (it gets verrry boring)

kthxn

Grok

#1
Stop using the IF( word = ... ) because it is not needed.


Replace() function has an implicit if() built-in.  It will only replace occurrences of the word it finds.  You want:

strMessage = Replace(strMessage, "fuck", "!$*!")

which is also case-sensitive and will find all upper/lower cases.

I posted a perfectly usable profanity filter a few messages or replies back using this method.  If you're wanting the profanity to be reversable though, you'll have to modify it.