SayCleanPackage 1.0.0

dotnet add package SayCleanPackage --version 1.0.0
                    
NuGet\Install-Package SayCleanPackage -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SayCleanPackage" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SayCleanPackage" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="SayCleanPackage" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SayCleanPackage --version 1.0.0
                    
#r "nuget: SayCleanPackage, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=SayCleanPackage&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=SayCleanPackage&version=1.0.0
                    
Install as a Cake Tool

SayCleanPackage

A simple, fast, and extensible bad word filter for .NET.

Perfect for filtering:

  • Usernames
  • Display names
  • Nicknames
  • Comments
  • Any user input!

INSTALLATION

Install via NuGet:

dotnet add package SayCleanPackage

Or in Visual Studio:

Manage NuGet Packages → Search "SayCleanPackage" → Install

USAGE

// Example usage:

using SayCleanPackage;

var result = SayClean.Filter("This is a shit username");

Console.WriteLine($"IsClean: {result.IsClean}");
Console.WriteLine($"MatchedWords: {string.Join(", ", result.MatchedWords)}");
Console.WriteLine($"CleanedOutput: {result.CleanedOutput}");

EXAMPLE OUTPUT

IsClean: False MatchedWords: shit CleanedOutput: This is a **** username


FEATURES

  • Fast bad word detection (using Trie)
  • Supports flexible patterns (ex: "f.u.c.k", "f u c k")
  • Customizable dictionary
  • Extension method for string.SayClean()
  • Clean architecture, testable and pluggable

API

SayClean.Filter(string input)

Returns a SayCleanResult:

public class SayCleanResult
{
    public bool IsClean { get; set; }
    public List<string> MatchedWords { get; set; }
    public string CleanedOutput { get; set; }
}

EXAMPLE SCENARIOS

  • Username validation
  • Chat message filtering
  • Forum comments
  • Game nicknames
  • User profile fields
  • Protecting public content

TARGET FRAMEWORK

  • .NET 9.0
  • Compatible with .NET 6, .NET 7, .NET 8 (if you edit csproj)

LICENSE

MIT License.


CONTRIBUTING

Pull requests are welcome! Have ideas? Open an issue.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 137 6/3/2025