Convert Chinese symbols to English punctuation

The full-angle to half-angle function, the
Convert Chinese symbols to English punctuation


function stringFromCharCode(str){ 
    var tmp = ""; 
    for(var i=0;i<str.length;i++){ 
        if(str.charCodeAt(i) >= 65281 && str.charCodeAt(i) <= 65374) {// If at full width! To the full-width ~ interval 
            tmp += String.fromCharCode(str.charCodeAt(i)-65248) 
        }else if(str.charCodeAt(i) == 12288){//The value of the full-width space, it does not follow the relative to ASCII Offset, must be handled separately 
            tmp += ' '; 
        }else{// Do not handle full-width spaces, full-width! To the character 
            tmp += str[i]; 
        } 
    } 
    return tmp; 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326450572&siteId=291194637