Convert double byte integer to single byte - Javascript Number Operation

Javascript examples for Number Operation:Integer

Description

Convert double byte integer to single byte

Demo Code

ResultView the demo in separate window

<html>
   <head></head>
   <body> 
      <script>
(function() {//from w ww . j a  v  a  2s .  c o  m
  var rex = /[\uFF10-\uFF19]/g;
  var str = "my value";
  console.log("Before: " + str);
  str = str.replace(rex, function(ch) {
    return String.fromCharCode(ch.charCodeAt(0) - 65248);
  });
  console.log("After: " + str);
})();

      </script>  
   </body>
</html>

Related Tutorials