special_characters_handler 1.0.1 copy "special_characters_handler: ^1.0.1" to clipboard
special_characters_handler: ^1.0.1 copied to clipboard

A powerful framework for handling special characters, emojis, and HTML entities in strings

example/special_characters_handler_example.dart

import 'package:special_characters_handler/special_characters_handler.dart';

void main() {
  /*print(CharacterUtils.isPunctuation('!')); // true
  print(CharacterUtils.isPunctuation('#')); // true
  print(CharacterUtils.isPunctuation('@')); // true
  print(CharacterUtils.isPunctuation('*')); // true
  print(CharacterUtils.isPunctuation('A')); // false

  // Test de conversion
  String text = "H'ello! @ World*";
  print(CharacterUtils.toUrlFriendly(text));


  final handler = SpecialCharactersHandler();
  String texte = "Hello 😊 World 🌍";

  // Utilisation du handler
  print(handler.containsEmoji(texte));         // true
  print(handler.extractEmojis(texte));         // ["😊", "🌍"]
  print(handler.containsEmoji(texte));           // 2

  // Utilisation des extensions String
  print(texte.containsEmoji());                // true
  print(texte.extractEmojis());                // ["😊", "🌍"]


  // Nettoyage avec options
  final cleaned = handler.clean(
      texte,
      options: CleaningOptions(removeEmojis: true)
  );
  print(cleaned);*/

  String texte = "Héllô 😊 "Wórld" 🌍 @#çà";

  final handler = SpecialCharactersHandler();

  // Vérification des caractères spéciaux
  if (handler.containsSpecialCharacters(texte)) {
    print("Le texte contient des caractères spéciaux");
  }

  // Analyse complète
  TextAnalysisResult analyse = texte.analyzeText();
  print(analyse);

  // Test des différents types de caractères
  print('Est un caractère spécial @: ${CharacterUtils.isPunctuation("@")}');
  print('Est un symbole ©: ${CharacterUtils.isSymbol("©")}');
  print('Est une lettre é: ${CharacterUtils.isLetter("é")}');
  print('Est un chiffre 5: ${CharacterUtils.isDigit("5")}');

  // Nettoyage
  String cleaned = handler.clean(texte, options: CleaningOptions(
    removeEmojis: true,
    removeHtmlEntities: true,
    convertAccents: true,
    normalizeUnicode: true,
  ));
  print('Texte nettoyé: $cleaned');

}
2
likes
140
points
76
downloads

Publisher

unverified uploader

Weekly Downloads

A powerful framework for handling special characters, emojis, and HTML entities in strings

Homepage
Repository (GitHub)
View/report issues

Topics

#string #text-processing #unicode #html #emoji

Documentation

API reference

License

MIT (license)

Dependencies

characters, collection, html_unescape, meta, unicode

More

Packages that depend on special_characters_handler