filter out offensive phase/text

S

Sam

Hi all,

I have feedback page which allows users to submit input text. Is there a way
to filter out offensive language (some kind of validation check), say I have
a list of words in a table that I want to check against. Any help would be
greatly appreciated.

Regards,

Sam
 
S

Swanand Mokashi

You can have 2 columns in a sql table - offensive word and what you want it
replaced by eg would be ass (WordToReplace) and a** (ReplaceBy)

then you can get that data in your code and loop through the rows and
replace the offensive word (if found in the input text) and replace it with
what you want it replaced with.

So user enters "you are an ass" then

foreach (DataRow badWord in badWordsDataTable)//get the data loop going
{
//say userInput is the string that contains the user input
userInput = userInput.Replace(badWord["WordToReplace"],
badWord["ReplaceBy"]);
}

HTH
--
Swanand Mokashi
Microsoft Certified Solution Developer (.NET) - Early Achiever
Microsoft Certified Application Developer (.NET)

http://www.dotnetgenerics.com/
DotNetGenerics.com -- anything and everything about Microsoft .NET
technology ...

http://www.swanandmokashi.com/
http://www.swanandmokashi.com/HomePage/WebServices/
Home of the Stock Quotes, Quote of the day and Horoscope web services


Sam said:
Hi all,

I have feedback page which allows users to submit input text. Is there a
way to filter out offensive language (some kind of validation check), say
I have a list of words in a table that I want to check against. Any help
would be greatly appreciated.

Regards,

Sam



--
 
M

Mark Rae

You can have 2 columns in a sql table - offensive word and what you want
it replaced by eg would be ass (WordToReplace) and a** (ReplaceBy)

Does anyone remember many years ago when CompuServe implemented a similar
function on their online registration process...?

For a while, no-one in the town of Scunthorpe in the UK was able to
register... :)
 
S

Swanand Mokashi

That is why you replace the offensive word by *** instead of not allowing
the user to post the information :)

--
Swanand Mokashi
Microsoft Certified Solution Developer (.NET) - Early Achiever
Microsoft Certified Application Developer (.NET)

http://www.dotnetgenerics.com/
DotNetGenerics.com -- anything and everything about Microsoft .NET
technology ...

http://www.swanandmokashi.com/
http://www.swanandmokashi.com/HomePage/WebServices/
Home of the Stock Quotes, Quote of the day and Horoscope web services
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top