类
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 类
{
class Program
{
static void Main(string[] args)
{
//String Math
string a = " abCdefgd8 ";
int c = a.IndexOf("d");//从前面开始找,找到第一个,数它的索引号
int d = a.LastIndexOf("d");
bool b = a.Contains("dd");//是否包含此字符串
Console.WriteLine(d);
//int b = a.Length;//长度
//Console.WriteLine(b);
//string c = a.Trim();//去掉前后空格
//Console.Write(c);
//Console.Write("
");
//string d = a.TrimStart();//去掉前空格
//Console.Write(d);
//Console.Write("
");
//string e = a.TrimEnd();//去掉后空格
//Console.Write(e);
//Console.Write("
");
//string f = a.ToUpper();//全部将小写字母转换为大写
//Console.WriteLine(f);
//string g = a.ToLower();//全部将大写字母转换为小写
//Console.WriteLine(g);
////索引号是从0开始的
//string h = a.Substring(4);
////里面一个值,表示从这个索引开始一直截取到最后
//Console.WriteLine(h);
//Console.WriteLine(a.Substring(8));
////a = a.Substring(8);//若果不重新赋值,a是没有变化的
////两个值,表示从哪个索引号开始,截取多少长度
//string i = a.Substring(4,3);
//Console.WriteLine(i);
//a=a.Replace("de", "DE");
//Console.WriteLine(a);
//string j = "2012 12 23";
//string [] aa= j.Split( );//分割字符串,以什么字符
//foreach (string m in aa)
//{
// Console.WriteLine(m);
//}
//Math类
//double a=4.14;
//Console.WriteLine(Math.Ceiling(a));//取上线
//Console.WriteLine(Math.Floor(a));//取下线
//Console.WriteLine(Math.PI*a);//π 圆周率
//Console.WriteLine(Math.Round(a));//四舍五入
//注意:奇数.5的情况下,取上线
//偶数.5的情况下,取下线
Console.ReadLine();
}
}
}