normalizeArabic method

String normalizeArabic()

Implementation

String normalizeArabic() {
  if (isEmpty) return this;

  final Map<String, String> replacements = {
    'أ': 'ا',
    'إ': 'ا',
    'آ': 'ا',
    'ة': 'ه',
    'ى': 'ي',
    'ؤ': 'و',
    'ئ': 'ي',
    'ً': '',
    'ٌ': '',
    'ٍ': '',
    'َ': '',
    'ُ': '',
    'ِ': '',
    'ّ': '',
    'ْ': '',
  };

  String result = this;

  replacements.forEach((key, value) {
    result = result.replaceAll(key, value);
  });

  return result.toLowerCase().removeSpaces();
}