我刚好在看IO流
你可以这样做:
DataInputStream in=new DataInputStream(new StringBufferInputStream(objString));
int c;
boolean right=true;
while((c=in.read())!=-1)
  if(c>=65&&c<=96)//抱歉,ASCII码忘了,反正就是大小写的字母和数字之间的范围
     continue;
  else
     right=false;
return right;

解决方案 »

  1.   

    try{
       String s="你得到的字符串";
       s.getBytes("iso8859-1");
       System.out.println("字符串不包含中文");
       
    }catch(Exception e){
       System.out.println("字符串包含中文");
    }
    //这个方法是判断字符时候包含中文String tag="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    String s="你得到的字符串";
    for(int i=0;i<s.length();i++){
       if(tag.indexOf(s[i])<0)
          System.out.println("字符串包括其他的字符");
    }
    //这是判断字符是否全有0-9,a-z ,A-Z 组成祝你好运!
      

  2.   

    用正则表达式来解决:
    对于数字的判断,
    String s = "456555";
    Pattern p = Pattern.compile("[0-9]*");
            Matcher m = p.matcher(s);
            boolean b = m.matches();
    对于字母的判断,
    String s="JHubebmnd";
    Pattern p = Pattern.compile("[a-z,A-Z]*");
            Matcher m = p.matcher(s);
            boolean b = m.matches();
      

  3.   

    用正则表达式实现
    import java.util.regex.*;public class  Regex
    {
      public static void main(String[] args) 
      {
        Pattern p = Pattern.compile("[0-9]*");
        Pattern p1=Pattern.compile("[a-z]*");
        Matcher m = p.matcher(args[0]);
        boolean b = m.matches();
        if(b)
          System.out.println(args[0]+" is  number");
        m=p1.matcher(args[0]);
        boolean b1=m.matches();
        if(b1)
          System.out.println(args[0]+" is  character");
        if(!b&&!b1)
          System.out.println(args[0]+" is neither number nor character");
      }
    }
      

  4.   

    太复杂, 比较UTF-8编码就可: String str = ...; if (str.getBytes("UTF-8").length == str.getBytes().length) {
       // 字母或数字 (字母或数字的UTF-8编码的长度和其ASCII编码的长度一样)
     } else {
       // 至少有一个多字节字付
     }
      

  5.   

    不能判断字母数字你就自己写一个patten好了啊。专门判断是不是数字和字母的组合。