profanity_filter 1.0.0 copy "profanity_filter: ^1.0.0" to clipboard
profanity_filter: ^1.0.0 copied to clipboard

outdated

Simple class to create filters that check and censor strings against profanity. A default English words list is provided.

example/main.dart

import 'package:profanity_filter/profanity_filter.dart';

void main() {
  //Create the filter - default, so it uses the default English profanity list.
  final filter =
      ProfanityFilter(); //Other constructors are available, see README.
  String badString =
      'You are an ass'; //This string contains the profanity 'ass'

  //Check for profanity - returns a boolean (true if profanity is present)
  bool isStringProfane =
      filter.checkStringForProfanity(badString); //Returns 'true'
  print('The string $badString has profanity: $isStringProfane');

  //Get the profanity used - returns a List<String>
  List<String> profanityUsed = filter.getAllProfanityInString(badString);
  print(profanityUsed); //['ass']

  //Censor the string - returns a 'cleaned' string.
  String cleanString = filter.censorString(badString);
  print('Clean version of $badString is $cleanString');
}
110
likes
0
points
7.45k
downloads

Publisher

unverified uploader

Weekly Downloads

Simple class to create filters that check and censor strings against profanity. A default English words list is provided.

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on profanity_filter