zoukankan      html  css  js  c++  java
  • java,js判断全角半角

    function chkHalf(str){   
    
          for(var i=0;i
    
              {      
    
                 strCode=str.charCodeAt(i);      
    
                 if((strCode>65248)||(strCode==12288)){      
    
                           alert("有全角字符");   
    
                          break;    
    
                 }    
    
              }     
    
    } 
    
    
    
    
    
    
    
    if(str.getBytes().length==string.length){    
    
    //全是半角    
    
    }    
    
    if(str.getBytes().length > str.length && str.getBytes().length != str.length){    
    
    //混合    
    
    }    
    
    if(str.getBytes().length == str.length *2){    
    
    //全是全角    
    
    } 
  • 相关阅读:
    poj3255,poj2449
    poj2186
    poj3249
    poj3378
    poj3274
    poj1948
    hdu 2181暴搜
    hdu 3342
    hdu 1285
    hdu 1598
  • 原文地址:https://www.cnblogs.com/tnsay/p/5752566.html
Copyright © 2011-2022 走看看