底部代码将文本输入中的数字转换为波斯语数字和镜像。
我需要将原型转换为 jquery,请帮助我
String.prototype.toFaDigit = function() {
return this.replace(/\d+/g, function(digit) {
var ret = '';
for (var i = 0, len = digit.length; i < len; i++) {
ret += String.fromCharCode(digit.charCodeAt(i) + 1728);
}
return ret;
});
};
String.prototype.toEnDigit = function() {
return this.replace(/[\u06F0-\u06F9]+/g, function(digit) {
var ret = '';
for (var i = 0, len = digit.length; i < len; i++) {
ret += String.fromCharCode(digit.charCodeAt(i) - 1728);
}
return ret;
});
};
function ChekNumLang_ChekBox(MainTextFieldName) {
var fieldObj = document.getElementById(MainTextFieldName);
if (document.getElementById("FarsiNum").checked) {
fieldObj.value = fieldObj.value.toFaDigit();
}
else {
fieldObj.value = fieldObj.value.toEnDigit();
}