请问大家有何高招
就是只能使用字母和数字
其他的都算不合格

解决方案 »

  1.   

    public  static  boolean  hasFullSize(String  inStr){  
               if  (inStr.getBytes().length  !=  inStr.length())  {  
                       return  true;  
               }                                  
               return  false;  
    }  
     
    判断是否含有汉字如果你只能出入数字和字母,那分别写两个方法判断是否字母是否数字就可以了
      

  2.   

    楼上的程序判断很有局限性的吧,就算不是中文,其他乱七八糟的文字在里面也能得到false
      

  3.   

    楼上的兄弟,代码不错,学习ing……
    --------------------------
    判断字符串中是否含有字母及数字外的东东
    public static boolean haveOther(String s)
        {
            int len = s.length();
            for (int i=0; i<len; ++i)
            {
                char ch = s.charAt(i);
                if (!(((ch > 'a') && (ch < 'z')) || ((ch>'A') && (ch < 'Z')) || ((ch > '0') && (ch < '9'))))
                {
                    return true;
                }
            }
            return false;
        }
      

  4.   

    import java.util.regex.*;
    public class TestToDel {
       public static void main(String[] args) {
        String s = " abc d 滚 ";
        Pattern pa = Pattern.compile("[\u4E00-\u9FA0]",Pattern.CANON_EQ);
        Matcher m = pa.matcher(s);
        while(m.find()){
           System.out.println(m.group());
          }
      }
    }
    这样就可以把汉字筛选出来 !