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

outdated

Simple filter to check and censor strings against profanity, obscene words. A default English words list is provided (LDNOOBW).

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');
}
99
likes
0
pub points
95%
popularity

Publisher

unverified uploader

Simple filter to check and censor strings against profanity, obscene words. A default English words list is provided (LDNOOBW).

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on profanity_filter