473,412 Members | 2,294 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

Dirty word filter function has a problem

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) = "fuck"
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

Mar 17 '06 #1
3 1438
Really this is a serious question, can anybody help me?

The problem is the filter filters out good words like analysis because
of the 4 letters it starts with.

Thanks

Mar 20 '06 #2
then look for words with spaces either side them

--
Regards

John Timney
Microsoft MVP

<ba*****@yahoo.com> wrote in message
news:11*********************@z34g2000cwc.googlegro ups.com...
Really this is a serious question, can anybody help me?

The problem is the filter filters out good words like analysis because
of the 4 letters it starts with.

Thanks

Mar 20 '06 #3
normall you would add allowed roots along with unallowed.

say you disallowed disallowed

butt

which would also disallow the derivative

butthead

you would explicity allow

butte

which would allow the derivative

butter

-- bruce (sqlwork.com)


<ba*****@yahoo.com> wrote in message
news:11*********************@z34g2000cwc.googlegro ups.com...
Really this is a serious question, can anybody help me?

The problem is the filter filters out good words like analysis because
of the 4 letters it starts with.

Thanks

Mar 20 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Case Nelson | last post by:
Hi there I've just been playing around with some python code and I've got a fun little optimization problem I could use some help with. Basically, the program needs to take in a random list of no...
3
by: Charles Hartman | last post by:
I'm working on text-handling programs that want plain-text files as input. It's fine to tell users to feed the programs with plain-text only, but not all users know what this means, even after you...
1
by: gene.ellis | last post by:
Put simply, I have a text box, and people commonly cut + paste information into this text box from Microsoft word. The problem is that word has all types of funky characters (smart quotes,...
2
by: Salad | last post by:
I have a log file with a list of records. The log file can be unfiltered or filtered. I have a command button to call a data entry form from the log. At first I was only going to present the...
2
by: Ray Todd Jr | last post by:
Could someone please look at this code and tell me what I am missing, please? The problem that is occuring is I am given an error (5922) that states "Word was unable to open the data source" As...
1
by: Meken | last post by:
Hello! I have developed a function which create a word doc. It works fine for smaller amount of text but when I want to create larger documents something goes wrong! The application stops at...
10
by: Michael Maes | last post by:
Hi, I have a BaseClass from which many Classes Derive. In short: the BaseClass provides the functionalities (Methods) and the Derived Classes extend it with Properties. One of the (Base)...
5
by: Dan Iregren | last post by:
Hi, I need to know when a property has ben modified (IsDirty). The most obvious way to solve the problem is perhaps something like the following; Private m_sFirstName As String Private...
1
by: Shawn Eary | last post by:
Hello Everyone: I used VB.NET 2003 Standard to create a User Control which I named PersonControl and then overrode its OnLoad routine to use SQL commands to populate its sub-controls. When I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.