using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace day06
{
class Program
{
static void Main(string[] args)
{
/* string x = " abc ";
int i = x.Length;
Console.WriteLine(x);
Console.WriteLine(i);
Console.WriteLine(x.Trim().Length); //去掉x中的空格
Console.WriteLine(x.TrimEnd().Length);//去掉x中后面的空格
Console.WriteLine(x.TrimStart().Length);//去掉x中前面的空格
Console.WriteLine(x.ToUpper()); //把x中的小写转为大写
Console.WriteLine("请输入你的身份证号");
string x= Console.ReadLine();
string y = x.Substring(6,8); //截取x中从第六位开始的8个字符
Console.WriteLine(y);
string a=y.Substring(0,4);
string b=y.Substring(4,2);
string c=y.Substring(6,2);
Console.WriteLine("您的生日是" + a + "年" + b + "月" + c + "日");
Console.ReadKey();
string z = "我小字不想混字了字";
Console.WriteLine("你"+z.Substring(1).Replace("字了字","了").Replace("字","子")); //替换字符
//提取邮箱的用户名
Console.WriteLine("请输入你的邮箱地址:");
string q = Console.ReadLine();
if (q.Contains("@"))
{
Console.WriteLine("您的用户名是:" + q.Substring(0, q.IndexOf("@")));
}
else
{
Console.WriteLine("您的输入有误");
}
Console.ReadKey();
Console.WriteLine("请输入一个年份");
string s = Console.ReadLine();
try
{
DateTime dt = new DateTime();
dt = Convert.ToDateTime(s+"/2/29");
Console.WriteLine(s+"是闰年");
}
catch (Exception)
{
Console.WriteLine(s+"不是闰年");
}
Console.ReadKey();
for (int i = 1; i <= 20; i ++)
{
for (int j = 1; j <= 20; j++)
{
if (i==9&&j==9||i==11&j==9||i==9&&j==11||i==11&&j==11||i==10||j==10)
{
Console.Write("◆");
}
else
{
Console.Write("◇");
}
}
Console.Write("
");
}
Console.ReadKey();
string s = "helloworld";
for (int i = 0; i < s.Length; i++)
{
Console.Write(s.Substring(i, 1).ToUpper()+" ");
}
Console.ReadKey();
Console.WriteLine("是否要烧开水(y/n)");
string x = Console.ReadLine();
if (x=="y")
{
for (int i = 0; i <= 100; i++)
{
switch (i)
{
case 30:
Console.WriteLine("水温了");
break;
case 50:
Console.WriteLine("水热了");
break;
case 80:
Console.WriteLine("水快开了");
break;
case 100:
Console.WriteLine("水已经开了");
break;
default: Console.WriteLine(i);
break;
}
}
}
Console.ReadKey();*/
}
}
}