isPersian function

bool isPersian(
  1. String input, [
  2. bool isComplex = false,
  3. Pattern? trimPattern
])

Check is the input string Persian or not returns true if the input is matched with Farsi char dataset RegExp, if not returns false

Implementation

bool isPersian(String input, [bool isComplex = false, Pattern? trimPattern]) {
  trimPattern ??= RegExp(trimPatternRegExp);
  var rawText = input.replaceAll(trimPattern, '');
  var faRegExp = isComplex ? faComplexText : faText;
  return RegExp('^[$faRegExp]+\$').hasMatch(rawText);
}