String class:
String a = "abcdefghijklmnopqrstuvwxyz";
int length = A.length; Gets the length of the string;
A = A.trimstart (); Remove the full space;
A = A.trimend (); Remove the trailing spaces;
A = A.trim (); Remove the space before and after;
A = A.toupper (); Converts the letters in a string to uppercase;
A = A.tolover (); Converts the English in a string to lowercase;
A = A.substring (); Truncation string
The parameters in the truncated string parentheses can be placed one, for example (1), or two, for example (n);
When a parameter is placed, the nth string is truncated from the beginning;
The two parameters represent the start of the n position and the truncation of n strings;
int B = A.indexof ("G"); Starting with 0, gets the position of the character in parentheses, if there are more than one character, only gets the first bit, no match returns-1;
int B = A.lastindexof ("a"); Gets the position of the last character in parentheses, if there are more than one character, only the first character within the parentheses is the position of the string;
BOOL B = A.contains ("a"); Boolean, which determines whether there is a return true, otherwise returns false;
A = A.replace ("abc", "XYZ"); Replace, replace the first value in parentheses with the second one, replace all, and the data type needs to be redefined;
A = A.remove (5); Delete, remove all the characters from the 5 position;
There can also be two values in parentheses, for example: (3,2); Remove 2 from 3 positions;
Math class:
Double m = 3.456;
x = Math.Round (x); Rounded
x = Math.Round (x*10)/10; Get the decimal one, and so on;
x = Math.PI (x); Get the value of pi;
Datetame class:
The datetime type's year, month, day, time, minute, and second are all the same except for the code's different external methods;
A new object needs to be created;
DateTime d = new DateTime (1995,06,29,23,59,59); Create a new 1995 year ... of the object;
Or is:
DateTime d = new DateTime (); Define a time variable D;
D = Convert.todatetime ("1995-06-29 23-59-59"); Assigned value;
Console.writhline(d.tostring("yyyy mm DD day hh (mm min. ss seconds")); This method can be obtained June 29, 1995 ... ;
Yyyy-year mm-month dd-Day hh-12 system hour HH-24 system hour mm-minutes ss-seconds ms-milliseconds;
TimeSpan NewTime = Large time-small time;
D.addyears (100); Increase by 100 years in D at this time;
int DD = D.year; Get d The year of this time;
int nowday = D.dayofyear; Get today is D date is the first day of D year;
2017-11-02 C # String Class &math class &datetime class