Created
March 5, 2017 10:36
-
-
Save sijad/07a2e7827503134a772ba8f6554cd264 to your computer and use it in GitHub Desktop.
conveer English to Persian number
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
function convertToPersian(str) { | |
var newStr = ''; | |
for (var i = 0; i < str.length; i++) | |
{ | |
var c = str.charCodeAt(i); | |
if (c >= 48 && c <= 57) { | |
c += 1728; | |
} | |
newStr += String.fromCharCode(c); | |
} | |
return newStr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment