23-09-2008, 02:58 AM
GIAKEN Wrote:Unfortunately, it won't work...it will only replace the last swear word in the string. Like this:
Msg = "shit whore fuck bitch" for example...
CheckMessage = "**** whore fuck bitch" but Msg is still the same so it will look for the second swear...so then
CheckMessage = "shit ***** fuck bitch" and then Msg will still equal the same thing...so you do:
Code:Public Function CheckMessage(byval Msg As String) As String
Dim i As Long
For i = 0 To UBound(SwearArray)
CheckMessage = Replace$(Msg, SwearArray(i), ReplaceSwearArray(i), , , vbTextCompare)
If CheckMessage Msg Then Msg = CheckMessage
Next i
End Function
Also changed i to a Long because it's the fastest type to use for loops.
Ah true, thanks for that first fix, hadn't thought of that. And yeah, I thought of using I as a long for the loop, I'll probably do that

