toPersianDigits function
- String input
Replaces the ASCII digits 0 to 9 in input with Persian digits ۰ to ۹.
Every other character is kept, so toPersianDigits('1403/01/01') is
۱۴۰۳/۰۱/۰۱.
Implementation
String toPersianDigits(String input) => String.fromCharCodes(
input.codeUnits.map(
(c) => c >= _latinZero && c <= _latinZero + 9
? c - _latinZero + _persianZero
: c,
),
);