我在写一个SOCKET的程序,想过滤客户端发送过来的字符,验证是否为123456789abcdefghijklmnopqrstuvwxyz,请问怎么操作,谢谢

解决方案 »

  1.   

    从流获得串 然后判断public int read(char[] cbuf,
                    int off,
                    int len)
             throws IOException
      

  2.   

        String str = "121212aacdsfd";
        if(!Pattern.matches("[1-9a-z]+",str)) { // 判断是否为1-9和a-z的组成
          System.out.println("Illigle charactor found!");
        }