toArabic method

String toArabic()

Converts English numerals in the string to Arabic numerals.

This method iterates through each English numeral and replaces it with the corresponding Arabic numeral.

Example:

String englishNumber = "123";
String arabicNumber = englishNumber.toArabic();
print(arabicNumber); // Output: "١٢٣"

Returns: A new string with English numerals replaced by Arabic numerals.

Implementation

String toArabic() {
  String number = this;
  for (int i = 0; i < _english.length; i++) {
    number = number.replaceAll(_english[i], _arabic[i]);
  }
  return number;
}