有一个字符串str,如果它其中含有数字、小写字母、大写字母,那么就返回“True”否则返回“false”,这样的函数应该怎样写???

解决方案 »

  1.   

    正则。。
    "^[A-Za-z0-9\+]+$"
      

  2.   

    "^[A-Za-z0-9\+]+$"
    可不可以详细点嘞。
      

  3.   

    public static bool Check(string checkedStr)
    {
    return Regex.IsMatch(checkedStr, @"^[\w^_]$");
    }
      

  4.   

    function Tvalidation()
             {
                var temp = document.getElementById("text1");
                var myreg = /^[A-Za-z0-9\+]+$/;
                if(!myreg.test(temp.value))
                {
                    myreg.focus();
                    return false;
               }
            }
    JS验证的不知道正则对不对。
      

  5.   

    Regex.IsMatch  方法。。 写正则。 或者用js验证正则  
      

  6.   


                List<string> list = new List<string> { "aaaa", "11111", "AAAaaAA", "aaaAA111" };
                Regex reg = new Regex(@"^(?![^a-z]+$)(?![^A-Z]+$)(?!\D+$)[a-zA-Z\d]+$");
                foreach(string s in list)
                {
                    Console.WriteLine(reg.Match(s).Success);
                }
                Console.ReadLine();
    /*
    false
    false
    false
    true
    */