Skip to content

Instantly share code, notes, and snippets.

@sijad
Created March 5, 2017 10:36
Show Gist options
  • Save sijad/07a2e7827503134a772ba8f6554cd264 to your computer and use it in GitHub Desktop.
Save sijad/07a2e7827503134a772ba8f6554cd264 to your computer and use it in GitHub Desktop.
conveer English to Persian number
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