rt

解决方案 »

  1.   

    用正则表达式
    import java.util.regex.*;
    public class TestString{
    public static void main(String[] args){
    String s="asc2123aA";
    Pattern pa = Pattern.compile("\\w+");
    Matcher ma =pa.matcher(s);
    while(ma.find()){
    System.out.println(ma.group());
    }
    }
    }
      

  2.   

    不对,你这样不是检测,
    应该是
    Pattern p=Pattern.compile("\\W+);
    Matcher m=p.matcher(s);
    if (m.matches())
       System.out.println(s+":its'not a password");
      

  3.   

    是小写的w,不是大写.我想了个名字:
    iswWordCharacter如果你要封装的话,就稍微修改一下程序就可以了.
      

  4.   

    String s = "'asc2123aA";这个不合法字符串不能识别出来啊
      

  5.   

    回复人: interhanchi(艰难困苦,玉汝于成!) ( ) 信誉:105  2005-9-13 11:55:33  得分: 4  
     
     
       
    是小写的w,不是大写.我想了个名字:
    iswWordCharacter如果你要封装的话,就稍微修改一下程序就可以了.
    不是小写的w,这个函数是判断是否存在非数字,字母 的符号。所以是大写的