1.判断字符串是否数字 

int n;
if (int.TryParse("String", out n))  //如果是数字
{ 
       //..........
}

2.字符串数字千分位格式化 1136=>1,136.00

String.Format("{0:N2}", float.Parse(wage))

3. 数字转字符串,左位补0

int num = 6;
String numStr = num.ToString().PadLeft(3, '0');   //006

4、参数数组化 params string[] colIds 

5、使用md5编码

public static string GetStrMd5(string ConvertString) {
      MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
      string md5_str = BitConverter.ToString(md5.ComputeHash(UTF8Encoding.Default.GetBytes(ConvertString)));
      md5_str = md5_str.Replace("-", "");
      return md5_str.ToLower();
}
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-08
  • 2021-10-24
  • 2021-12-11
猜你喜欢
  • 2021-12-20
  • 2022-12-23
  • 2021-09-03
  • 2022-03-07
  • 2021-09-23
  • 2021-05-19
  • 2021-06-27
相关资源
相似解决方案