1 /// <summary>
2 /// 將字符串轉成二進制
3 /// </summary>
4 /// <param name="s"></param>
5 /// <returns></returns>
6 public static string bianma(string s)
7 {
8 byte[] data = Encoding.Unicode.GetBytes(s);
9 StringBuilder result = new StringBuilder(data.Length * 8);
10
11 foreach (byte b in data)
12 {
13 result.Append(Convert.ToString(b, 2).PadLeft(8, '0'));
14 }
15 return result.ToString();
16 }
將二進制轉成 字符串html
1 /// <summary>
2 /// 將二進制轉成字符串
3 /// </summary>
4 /// <param name="s"></param>
5 /// <returns></returns>
6 public static string jiema(string s)
7 {
8 System.Text.RegularExpressions.CaptureCollection cs =
9 System.Text.RegularExpressions.Regex.Match(s, @"([01]{8})+").Groups[1].Captures;
10 byte[] data = new byte[cs.Count];
11 for (int i = 0; i < cs.Count; i++)
12 {
13 data[i] = Convert.ToByte(cs[i].Value, 2);
14 }
15 return Encoding.Unicode.GetString(data, 0, data.Length);
//JS 進行計算天然年月季度周天數
var now = new Date();
//加五天.
var newDate = DateAdd("d ", 5, now);
alert(newDate.toLocaleDateString())
//加兩個月.
newDate = DateAdd("m ", 2, now);
alert(newDate.toLocaleDateString())
//加一年
newDate = DateAdd("y ", 1, now);
alert(newDate.toLocaleDateString())post
}
}ui
轉載於: https://www.cnblogs.com/weihengblogs/archive/2013/12/23/3487257.html