Last active
May 20, 2025 17:51
-
-
Save NedaMani/96e2fe97d40f80a38a29b18e1d907fb3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ConvertToFaNumber(str: string): string { | |
const FaDigits = ['۰','۱','۲','۳','۴','۵','۶','۷','۸','۹']; | |
return str.replace(/\d/g, d => FaDigits[parseInt(d)]); | |
} | |
function ConvertToEnNumber(str: string): string { | |
const FaDigits = ['۰','۱','۲','۳','۴','۵','۶','۷','۸','۹']; | |
return str.replace(/[۰-۹]/g, d => FaDigits.indexOf(d).toString()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment