Valhalla Legends Forums Archive | Battle.net Bot Development References | Reversing ProfanityUnfilter

AuthorMessageTime
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.
[code]
Public Function ProfanityUnfilter(strMessage As String) As String
If InStr(strMessage, "fuck") <> 0 Then strMessage = Replace(strMessage, "fuck", "!$%!")
ProfanityUnfilter = strMessage
End Function
[/code]
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
January 11, 2003, 7:57 AM
Grok
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.
January 11, 2003, 10:17 AM

Search