日期:2014-05-17 浏览次数:20890 次
//Random随机数
Random r = new Random();
while (true)
{
int i = r.Next(1, 7);
Console.WriteLine(i);
Console.ReadKey();
}
//指定分隔符数组,返回不带空格符的字符串
string str = "my name is lei";
char[] a = { ' ' };
string[] b = str.Split(a,StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < b.Length; i++)
{
Console.WriteLine(b[i]);
}
Console.ReadKey();
//倒序输出
Console.WriteLine("请输入字符串");
string a = Console.ReadLine();
string[] d = a.Split(' ');
for (int i = d.Length - 1; i >= 0;i-- )
{
Console.Write(d[i]+" ");
}
Console.ReadKey();
//忽略大小写
string a = "a";
string b = "A";
if (a.Equals(b,StringComparison.OrdinalIgnoreCase))
{
Console.Wr