1 class Program
2 {
3 static void Main(string[] args)
4 {
5 //Console.WriteLine("请输入你喜欢的课程");
6 //string lessonOne = Console.ReadLine();
7 ////将字符串转换成大写
8 ////lessonOne = lessonOne.ToUpper();
9 ////将字符串转换成小写形式
10 ////lessonOne = lessonOne.ToLower();
11 //Console.WriteLine("请输入你喜欢的课程");
12 //string lessonTwo = Console.ReadLine();
13 ////lessonTwo = lessonTwo.ToUpper();
14 ////lessonTwo = lessonTwo.ToLower();
15 //if (lessonOne.Equals(lessonTwo,StringComparison.OrdinalIgnoreCase))
16 //{
17 // Console.WriteLine("你们俩喜欢的课程相同");
18 //}
19 //else
20 //{
21 // Console.WriteLine("你们俩喜欢的课程不同");
22 //}
23 //Console.ReadKey();
24
25 /*分割字符串Split*/
26 //string s = "a b dfd _ + = ,,, fdf ";
27 //char[] chs = { ' ', '_', '+', '=', ',' };
28 //string[] str = s.Split(chs, StringSplitOptions.RemoveEmptyEntries);
29 //for (int i=0;i<str.Length;i++)
30 //{
31 // Console.WriteLine(str[i]);
32 //}
33 //Console.ReadKey();
34
35
36 //练习:从日期字符串("2008-08-08")中分析出年、月、日;2008年08月08日。
37 //让用户输入一个日期格式如:2008-01-02,你输出你输入的日期为2008年1月2日
38 //string s = "2008-08-08";
39 //char[] chs = { '-' };
40 //string[] date = s.Split(chs, StringSplitOptions.RemoveEmptyEntries);
41 //Console.WriteLine("{0}年{1}月{2}日", date[0], date[1], date[2]);
42 //Console.ReadKey();
43
44
45 /*老赵*/
46 //string str = "国家关键人物老赵";
47 //if (str.Contains("老赵"))
48 //{
49 // str = str.Replace("老赵", "**");
50 //}
51 //Console.WriteLine(str);
52 //Console.ReadKey();
53
54
55 /*Substring 截取字符串*/
56 //string str = "今天天气好晴朗,处处好风光";
57 //str = str.Substring(1,2);
58 //Console.WriteLine(str);
59 //Console.ReadKey();
60
61
62 //string str = "今天天气好晴朗,处处好风光";
63 //if (str.EndsWith("风"))
64 //{
65 // Console.WriteLine("是的");
66 //}
67 //else
68 //{
69 // Console.WriteLine("不是的");
70 //}
71 //Console.ReadKey();
72
73
74 //string str = "今天天气好晴朗,天天处天好风光";
75 //int index = str.IndexOf('哈', 2);
76 //Console.WriteLine(index);
77 //Console.ReadKey();
78
79
80 //string str = "今天天气好晴朗,处处好风光";
81 //int index = str.LastIndexOf('天');
82 //Console.WriteLine(index);
83 //Console.ReadKey();
84
85
86 /*LastIndexOf Substring*/
87 //string path = @"c:\a\b\c苍\d\e苍\f\g\\fd\fd\fdf\d\vfd\苍老师苍.wav";
88 //int index = path.LastIndexOf("\\");
89 //path = path.Substring(index + 1);
90 //Console.WriteLine(path);
91 //Console.ReadKey();
92
93 /*去掉空格*/
94 //string str = " hahahah ";
95 //str = str.Trim();
96 //str = str.TrimStart();
97 //str = str.TrimEnd();
98 //Console.Write(str);
99 //Console.ReadKey();
100
101 /*判断是否为空*/
102 //string str = "fdsfdsfds";
103 //if (string.IsNullOrEmpty(str))
104 //{
105 // Console.WriteLine("是的");
106 //}
107 //else
108 //{
109 // Console.WriteLine("不是");
110 //}
111 //Console.ReadKey();
112
113 /*张三|李四|王五|赵六|田七*/
114 //string[] names = { "张三", "李四", "王五", "赵六", "田七" };
115 //string strNew = string.Join("|", "张三","李四","王五","赵六","田七");
116 //Console.WriteLine(strNew);
117 //Console.ReadKey();
118
119 }
120 }