splitIntoWords function

List<String> splitIntoWords(
  1. String text
)

Split text into words and filter out Ayah numbers

Implementation

List<String> splitIntoWords(String text) {
  final words = text.split(RegExp(r'\s+'));
  // Filter out Ayah numbers (Arabic numerals ٠-٩ and English numerals 0-9)
  return words.where((word) => !RegExp(r'^[\d٠-٩]+$').hasMatch(word)).toList();
}