string a="abc";
Console.WriteLine(a); 输出a字符串的内容
Console.WriteLine($"Hello+{a}"); 输出Hello+a变量内容
Console.WriteLine($"Hello+{a.Length}"); 输出Hello+a变量字符数量
string b=" abc ";
Console.WriteLine(b.TrimStart()); 输出去除b变量字符串前面的空格
Console.WriteLine(b.TrimEnd()); 输出去除b变量字符串后面的空格
Console.WriteLine(b.Trim()); 输出去除b变量字符串后面的空格
string c="Hello abc";
Console.WriteLine(c .Replace("Hello", "Greetings")); 把Hello 换成 Greetings 原变量不改变 Console.WriteLine(c.ToUpper()); 大写字母
Console.WriteLine(c.ToLower()); 小写字母
Console.WriteLine(c.Contains("abc")); 搜索abc字符有则输出ture Console.WriteLine(songLyrics.StartsWith("Hello")); 搜索开头字符为Hello是输出ture Console.WriteLine(songLyrics.EndsWith("hello")); 搜索结尾字符为Hello是输出false
decimal 数据类型 精度大于double M 后缀指明了常数应如何使用 decimal 类型。 否则,编译器假定为 double 类型。
decimal min = decimal.MinValue;
decimal max = decimal.MaxValue;
获取最小最大范围
Math.PI 数学π var names = new List<string> { "<name>", "Ana", "Felipe" };
foreach (var name in names) { Console.WriteLine($"Hello {name.ToUpper()}!"); } 定义一个字符串表并且循环每一个内容,将内容大写 names.Add("Bill");
names.Remove("Ana"); 添加与移除 names[n]表示第几个从0开始
names.count表示表大小
names.IndexOf("Felipe")返回元素的位置找不到返回-1
names.Sort()对表排序