Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Chat Swear Filter
#2
Well, I changed it a bit, and I thought I could share


Code:
Public Function CheckMessage(Msg As String)
Dim SwearSplit() As String
Dim SwearReplaceSplit() As String
Dim Swears As String
Dim SwearReplace As String
Dim i As Integer
    
    Swears = "ass,fuck,shit,bitch,"
    SwearReplace = "***,f**k,s**t, b****,"
    
    SwearSplit = Split(Swears, ",")
    SwearReplaceSplit = Split(SwearReplace, ",")
      
    For i = 0 To UBound(SwearSplit)
        If InStr(LCase(Msg$), LCase(SwearSplit(i))) Then
              Msg$ = Replace$(LCase(Msg$), LCase(SwearSplit(i)), LCase(SwearReplaceSplit(i)), 1)
        End If
    Next i
    
End Function

What I did is removing the Useless Byval Index as long and exept of remplacing whole insult by ***, you can change to whatever you want
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)