Answers for "convert numbers in to arabic numbers in flutter"

0

convert numbers in to arabic numbers in flutter

String replaceFarsiNumber(String input) {
  const english = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
  const farsi = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'];

  for (int i = 0; i < english.length; i++) {
    input = input.replaceAll(english[i], farsi[i]);
  }

  return input;
}

main() {
  print(replaceFarsiNumber('0-1-2-3-4-5-6-7-8-9'));  // ==>  ۰-۱-۲-۳-۴-۵-۶-۷-۸-۹
}
Posted by: Guest on April-19-2021

Code answers related to "convert numbers in to arabic numbers in flutter"

Browse Popular Code Answers by Language