Is possible to convert double byte integer to single byte using java script ?? I need to convert double byte numbers as single byte,when it is entered into a text box.Is there any method available in jQuery or javascript.
There's no built-in way to convert 1 (U+FF11) to 1 (U+0031). You could use a regular expression to do it specifically for the characters you mentioned:
var rex = /[\uFF10-\uFF19]/g;
var str = "1234";
console.log("Before: " + str);
str = str.replace(rex, function(ch) {
return String.fromCharCode(ch.charCodeAt(0) - 65248);
});
console.log("After: " + str);
Live Example (be sure to open the JavaScript console) | Source
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With