Skip to content

Instantly share code, notes, and snippets.

@ahmadidev
Created December 15, 2015 11:19
Replacing English numbers with Persian 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