ProfanityFilter class
Filter that lets you check and censor strings with profanity.
Create an instance with the default constructor to use the default list of English profanity. Use the other constructors to customize the profanity list.
Constructors
- ProfanityFilter()
- Creates a filter with the default list of profanity (from LDNOOBW on GitHub).
-
ProfanityFilter.filterAdditionally(List<
String> badWordsList) -
Creates a filter with a list containing the default English words and the
additional words provided in
badWordsList
. -
ProfanityFilter.filterOnly(List<
String> badWordsList) -
Creates a filter with a list containing only the words provided in the list
badWordsList
. -
ProfanityFilter.ignore(List<
String> ignoreList) -
Creates a filter with the default list of profanity, excluding the words in
ignoreList
.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
wordsToFilterOutList
↔ List<
String> -
getter/setter pair
Methods
-
censor(
String inputString, {String? replaceWith}) → String -
Returns a censored version of the
inputString
, with asterisk (*) pattern as default. -
censorString(
String inputString, {String? replaceWith}) → String -
checkStringForProfanity(
String inputString) → bool -
getAllProfanity(
String inputString) → List< String> - Returns a list of all profanity found in the string.
-
getAllProfanityFoundInString(
String inputString) → List< String> -
hasProfanity(
String inputString) → bool -
Returns
true
ifinputString
has profanity, false otherwise. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited