21-09-2008, 01:50 PM
How can I modify it so that there is more than one SwearChar that are Random. Such as: *!?@£$
Tried a few ways, but obviously would've failed.
EDIT: Managed to get it so it does random out of the characters "*!?@$":
Still need to make it actually do like "*!?@$" instead of "@@@@@".
Tried a few ways, but obviously would've failed.
EDIT: Managed to get it so it does random out of the characters "*!?@$":
Code:
Public Function CheckMessage(ByVal Msg As String) As String
Dim kArray() As String
Dim SwearCensor As String
Dim Swears As String
Dim i As Integer
Dim SwearChars As String
Dim SwearRnd As String
Dim strname As String
Swears = "ass,fuck,shit,bitch,biatch,cunt,whore,piss,bastard,crap,nigger,pussy,penis,vagina,wank,masterbate"
kArray = Split(Swears, ",")
SwearChars = "*@!?$"
SwearCensor = Len(SwearChars)
SwearRnd = Int((SwearCensor * Rnd) + 1)
strname = strname & Mid(SwearChars, SwearRnd, 1)
For i = 0 To UBound(kArray)
If InStr(LCase(Msg$), LCase(kArray(i))) Then
Msg$ = Replace$(LCase(Msg$), LCase(kArray(i)), LCase(String(Len(kArray(i)), strname)))
End If
Next i
CheckMessage = Msg
End Function
Still need to make it actually do like "*!?@$" instead of "@@@@@".