Whether the length intercepted by the string class contains a number

Source: Internet
Author: User
Tags email account

 Enter the ID number, intercept birthday, output//370303199003053330//console.write ("Please enter the ID number:");            String id = console.readline (); if (ID. Length = =)//{//String year = ID.            Substring (6,4); String month = ID.            Substring (10,2); String day = ID.            Substring (12,2);            Console.WriteLine ("Your Birthday is:" +year+ "year" +month+ "month" +day+ "Day"); }//else//{//Console.WriteLine ("Wrong input!")            ");            }//console.readline (); Mailbox format//1. There is only one @//2. Cannot start with @//[email protected] and. Cannot be together//[emai            L protected] At least one of them.            5. Cannot end with.//console.write ("Please enter your email account:");            String mail = Console.ReadLine (); bool a = mail.            Contains ("@"); if (a = = true)//{//int b = mail.            IndexOf ("@"); int c = mail.     LastIndexOf ("@");       if (b = = c)//{//if (b! = 0)//{// String mail1 = mail.            Substring (b); if (mail1.            Contains (".")) {//int d = mail1.            IndexOf ("."); if (d! = 1)//{//int e = Mail1.            LastIndexOf ("."); if (E! = Mail1. LENGTH-1)//{//Console.WriteLine ("email format entered correctly!            ");                        }//else//{// Console.WriteLine ("Wrong input!            ");            }//}//Else//{ Console.WriteLine ("Wrong input!            ");           //                } }//else//{//Console.WriteLine (" Wrong input!            "); }//}//Else//{//CONSOLE.W Riteline ("Wrong input!            "); }//}//Else//{//Console.WriteLine ("Wrong input!")            "); }//}//else//{//Console.WriteLine ("Wrong input!")            ");            }//string s = "abcdefghijklmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789"; Random Number class//random ran = new random ();//Initialize//double a = ran.            Next (10); int B = ran.            Next (s.length);            Console.WriteLine (a);            Console.ReadLine ();            Random out verification code, control the input, judge whether the correct//string s = "abcdefghijklmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789"; Random ran = newRandom ();            String Biao = ""; for (int i = 1; I <= 4; i++)//{//Biao + = S.substring (ran.            Next (s.length), 1);            }//console.writeline (Biao);            Console.Write ("Please enter the Verification Code:");            String shu = Console.ReadLine (); if (Shu. ToLower () = = Biao. ToLower ())//{//Console.WriteLine ("Input correct!")            "); }//else//{//Console.WriteLine ("Input Error!            ");            }//console.readline ();            Console.clear ();            Console.WriteLine ("123");            Console.ReadLine ();            string s = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";            Random ran = new random ();            for (;;)                {String A = ""; for (int i = 1; I <= 4; i++) {A + = S.substring (RAN).                Next (s.length), 1); } COnsole.                WriteLine (a);                Console.WriteLine ("Please enter the Verification Code:");                String B = Console.ReadLine ();                    if (b.tolower () = = A.tolower ()) {Console.WriteLine ("input correct");                Break                    } else {console.clear ();                Console.WriteLine ("Input Error"); }} console.readline ();

Whether the length intercepted by the string class contains a number

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.