B
bay_dar
Hi my dirty word filter function has a problem, it is over restrictive.
For instance the word "analysis" is ok, but the word "anal" is not.
Any advice? code below:
Public Function IsHaveDirtyWord(ByVal a_str_Text As String) As String
Dim badWordFound As String
badWordFound = ""
Dim intCounter As Integer
Dim arraySize As Integer
arraySize = 30
Dim dirtyArray(arraySize) As String
dirtyArray(0) = "anal"
dirtyArray(1) = "butthead"
dirtyArray(2) = "clitoris"
dirtyArray(3) = "clitty"
dirtyArray(4) = "cock"
dirtyArray(5) = "dildo"
dirtyArray(6) = "fart"
dirtyArray(7) = "****"
dirtyArray(8) = "gangbang"
dirtyArray(9) = "masturbat"
dirtyArray(10) = "meathope"
dirtyArray(11) = "nipple"
dirtyArray(12) = "pecker"
dirtyArray(13) = "penis"
dirtyArray(14) = "piss"
dirtyArray(15) = "pussy"
dirtyArray(16) = "rape"
dirtyArray(17) = "screw"
dirtyArray(18) = "shit"
dirtyArray(19) = "sperm"
dirtyArray(20) = "testicle"
dirtyArray(21) = "tittes"
dirtyArray(22) = "twat"
dirtyArray(23) = "vagina"
dirtyArray(24) = "whore"
dirtyArray(25) = "sodomy"
dirtyArray(26) = "slut"
dirtyArray(27) = "asswipe"
dirtyArray(28) = "asskisser"
dirtyArray(29) = "bastard"
For intCounter = 0 To arraySize - 1
If InStr(a_str_Text.ToLower, dirtyArray(intCounter)) <> 0
Then
badWordFound = dirtyArray(intCounter)
End If
Next
IsHaveDirtyWord = badWordFound
Return IsHaveDirtyWord
End Function
For instance the word "analysis" is ok, but the word "anal" is not.
Any advice? code below:
Public Function IsHaveDirtyWord(ByVal a_str_Text As String) As String
Dim badWordFound As String
badWordFound = ""
Dim intCounter As Integer
Dim arraySize As Integer
arraySize = 30
Dim dirtyArray(arraySize) As String
dirtyArray(0) = "anal"
dirtyArray(1) = "butthead"
dirtyArray(2) = "clitoris"
dirtyArray(3) = "clitty"
dirtyArray(4) = "cock"
dirtyArray(5) = "dildo"
dirtyArray(6) = "fart"
dirtyArray(7) = "****"
dirtyArray(8) = "gangbang"
dirtyArray(9) = "masturbat"
dirtyArray(10) = "meathope"
dirtyArray(11) = "nipple"
dirtyArray(12) = "pecker"
dirtyArray(13) = "penis"
dirtyArray(14) = "piss"
dirtyArray(15) = "pussy"
dirtyArray(16) = "rape"
dirtyArray(17) = "screw"
dirtyArray(18) = "shit"
dirtyArray(19) = "sperm"
dirtyArray(20) = "testicle"
dirtyArray(21) = "tittes"
dirtyArray(22) = "twat"
dirtyArray(23) = "vagina"
dirtyArray(24) = "whore"
dirtyArray(25) = "sodomy"
dirtyArray(26) = "slut"
dirtyArray(27) = "asswipe"
dirtyArray(28) = "asskisser"
dirtyArray(29) = "bastard"
For intCounter = 0 To arraySize - 1
If InStr(a_str_Text.ToLower, dirtyArray(intCounter)) <> 0
Then
badWordFound = dirtyArray(intCounter)
End If
Next
IsHaveDirtyWord = badWordFound
Return IsHaveDirtyWord
End Function