Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8221439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:55:29+00:00 2026-06-07T13:55:29+00:00

I am creating a website which include a comment area for users. Example a

  • 0

I am creating a website which include a comment area for users. Example a guestbook or a product review. And I want to restrict a user on posting inappropriate languages on the comment area. For example: vulgarities.

If the user input any vulgarities, the characters would be replace by * . *Example – from stupid to s * * * * **.

I had been researching on related website but it was unfruitful. Suggestions or tutorials on this would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T13:55:34+00:00Added an answer on June 7, 2026 at 1:55 pm

    There is no way to fully stop “bad language” from being used but you can try to prevent it by creating a text file that contains a bad word in every line. Then load the list of words from the file to a List<String> in your program. You can do so by doing the following:

    // The list of swear words
    List<string> swearWords = new List<string>();
    
    private void GetSwearWords()
    {
        // Get the path to the file that has the swear words list
        string path = <File Path>;
    
        // Open the text file
        TextReader reader = new StreamReader(path);
    
        // Loop through each line in the file.
        string line = "";
        while ((line = reader.ReadLine()) != null)
        {
           // Lower cases word and removes whitespaces
           string word = line.Trim().ToLower();
    
           // Adds the word to the list
           swearWords.Add(word);
        }
    }
    

    Then, to determine if a string has one of these bad words you do the following:

    private bool HasSwearWord(string text)
    {
        // Splits words, removes whitespace and any punctuation
        string[] wordArray = Regex.Split(text, @"\W+");
    
        // Check if any word in the string is a swear word
        foreach (string word in wordArray)
        {
            if (swearWords.Contains(word.ToLower()))
            {
                return true;
            }
        }
        return false;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Firefox session cookies I'm creating a website in which users are allowed
I'm creating a mobile website that will include a page from which people can
I'm creating a website in which I will be managing users and their permissions.
I am creating website (football, soccer) in ASP.NET MVC3 and I want have users
I am creating a website structure which will allow for multiple language packs for
I am a newbie in jscript and jquery. I am creating a website, which
I'm creating a ASP.NET MVC website and I was wandering which techniques do you
I am creating a website which uses jquery scrolling as the method of navigation
I have a website which is behaving oddly in terms of creating new sessions.
I am creating a website which has 1 dropdownlist that bound to Northwind database,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.