ToUpper()、ToLower()
更改字符串大小;
string programe="fdsahuiofdsaFDSHIUFDS";
Console.WriteLine(programe);
Console.WriteLine(programe.ToUpper());
Trim()
删除字符串前置空格与后置空格;
string programe=" fdsahuiofdsaFDSHIUFDS ";
Console.WriteLine(programe);
Console.WriteLine(programe.Trim());
Contains(“x”)
匹配字符串中是否有“x”字符串,返回值为布尔类型;
string pangram = "The quick brown fox jumps over the lazy dog.";
Console.WriteLine(pangram.Contains("fox"));
Console.WriteLine(pangram.Contains("cow"));
Random()
随机生成器
Random rand=new Random();
int coin=rand.next(0,2);
Math Class
Floor
Ceiling
返回大于或等于指定十进制数的最小整数值。
int admiun = 123456;
double adm = admiun / 2.0;
int p = (int)Math.Floor(adm);
int q = (int)Math.Ceiling(adm);