stringclass. The length of a length character. TrimStart Remove the space at the beginning of the string. TrimEND () Removes the space following the string. ToUpper () all uppercase. Tolower () All lowercase substring (start position, intercept length) substring (starting position) Indextof ("string") returns the index of the first occurrence of this string startswith ("string") Whether to start with this string, or to return True or Falseendswith ("string") Whether to end with this string Contins ("string") contains this string, replace ("Old word","new Word"replace the old word with the new Word math class ceiling () Take the line floor () to remove the thread Math.PI Pi math.sqrt () square root math.round () rounding (odd remove limit, even take line) DateTime class note in the use Before you initialize the datetime=Newdatetime () can not be initialized if getting the current time: DateTime=datetime.now//system time, run-time querygets the year dt.year gets the month dt. Month gets the day dt. Day gets the hour Dt.hour gets the sub dt. Minute gets the second dt. Second gets the day of the week DayOfWeek D=dt. DAYOFWeek; obtained is English in Chinese needs ToString conversion yyyy mm month DD Day hh lowercase delegate 12 o'clock uppercase represents 24 o'clock mm min ss seconds above is on behalf of the character. You can take the empty space in the string first. stringS=dt. Tosting ("yyyy mm month dd Day hh mm min ss sec";D atetime can increase or subtract the corresponding time add () increases or subtracts a certain interval addyears () increases or subtracts the year addmonth () increases or subtracts the month adddays () increases or subtracts the number of days plus or minus days, and the number of hours is the use of the Do The uble type. Others are int type exercises: Determine if the mailbox format is correct//1. Have and can only have one @//2. Cannot start with @//there is at least one after [email protected].//[email protected] and. Can't stay together.//5. Cannot end with.//Console.Write ("Please enter your email account:"); //string mail = Console.ReadLine (); //if (mail. Contains ("@"))//{ //int Aa=mail. IndexOf ("@"); //int BB =mail. LastIndexOf ("@"); //if (aa== bb)// { //bool a = mail. StartsWith ("@"); //if (!a)// { //string ss = Mail. Substring (AA); //if (ss. Contains (".")) // { //int dian = ss. IndexOf ("."); //if (dian! = 1)// { //int hou = ss. LastIndexOf ("."); //if (hou! = ss. LENGTH-1)// { //Console.WriteLine ("Enter the correct format for the mailbox!") "); // } //Else// { //Console.WriteLine ("Wrong input! "); // } // } //Else// { //Console.WriteLine ("Wrong input! "); // } // } //Else// { //Console.WriteLine ("Wrong input! "); // } // } //Else// { //Console.WriteLine ("Wrong input! "); // } // } //Else// { //Console.WriteLine ("Wrong input! "); // } //} //Else//{ //Console.WriteLine ("Wrong input! "); //}
Class 5.7