1.int i=x.length;//length (Gets the length of the string, returning a value of type int)
2.x=x.trim ();(remove space before and after the string)
TrimStart ();(Remove the preceding space)
TrimEnd ();(remove the trailing space)
3.x = X.toupper ();(convert lowercase English characters in a string to uppercase)
X=x.tolower ();(convert uppercase English characters in a string to lowercase)
4.string p=x.substring (6,8)//substring (m,n) intercepts a string from bit m, intercepts N
Replace ("", "")//replaces all strings that match the string condition of the specified segment.
5.Math class
Double A = 3.14;
A = Math.ceiling (a);//Fetch online
A = Math.floor (a);//Remove Line
A = Math.Round (a);
Rounded
It was an odd time, and it was. 5 Fetch online
At that time even, and was. 5 Remove the line
A = A * Math.pi;//pi is pi
A = Math.sqrt (a);//square root
6.
Date Time Class
Before you use it, you need to initialize it to new.
Just give him the system. When the current time is not available, new
DateTime dt = new DateTime ();
DT = DateTime.Now;
Get years, months, days, hours, minutes, seconds
int year = dt. year;
int month = dt. Month;
int day = dt. Day;
From the hour down are double types
Double hour = dt. Hour;
Double minute = dt. Minute;
Double second = dt. Second;
DayOfWeek dd = dt. DayOfWeek;
Take a few weeks
Placeholder
yyyy .... Years
Mm.... Month
Dd.... Day
HH .... When
Mm.... Score of
Ss.... Seconds
string s = dt. ToString ("yyyy mm month DD Day hh" mm minutes ss seconds ");
In the original time add how many years, months, days, hours, minutes, seconds
DT = dt. AddDays ();
DT = dt. AddHours ();
DT = dt. AddMinutes ();
DT = dt. AddYears ();
Example one: Enter the ID number to intercept the date of birth.
Example two: Please enter the mailbox, 1. There is only one @;2. Cannot begin with @; [email protected] after at least one.; [email protected] and. cannot be together; 5. cannot be ended with.
Example three: Please enter the time of the beginning of love, calculate how many days of love now.
Example four: Randomly generate a four-digit verification code and then validate against the input
Class and application of 9.c#