1.比較字串
private void button1_Click(object sender, EventArgs e) { if(string.Compare(textBox1 .Text .ToLower (),textBox2.Text.ToLower())<0) MessageBox.Show ("字串1小於字串2","資訊",MessageBoxButtons.OK,MessageBoxIcon.Information ); if (string.Compare(textBox1.Text.ToLower(), textBox2.Text.ToLower()) == 0) MessageBox.Show("字串1等於字串2", "資訊", MessageBoxButtons.OK, MessageBoxIcon.Information); if (string.Compare(textBox1.Text.ToLower(), textBox2.Text.ToLower()) > 0) MessageBox.Show("字串1大於字串2", "資訊", MessageBoxButtons.OK, MessageBoxIcon.Information); }
2.日期年月日
DateTime dt1 = new DateTime(n1+60, y1, r1);TimeSpan ts = dt1 - DateTime.Now;Console.WriteLine("從現在到其60周歲期間,總共{0}天",ts.Days.ToString ());
3.XMLHTTP向伺服器端發送和接受的壓縮的字串(位元組傳送)
發送:str=UnicodeEncoding.UTF8.GetBytes(p_sStr);接收:Object =UnicodeEncoding.GetEncoding(936).GetString((byte[])http.responseBody);