Created
December 15, 2015 11:19
-
-
Save ahmadidev/4e3e53a7101dca1a5188 to your computer and use it in GitHub Desktop.
Replacing English numbers with Persian characters
This file contains 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
var persianNumbers = [ '۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹' ]; | |
var getPersianNumbers = function(str) { | |
return ('' + str).replace(/(\d)/g, function(x) { return persianNumbers[x]; }); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment