扩展方法:
     /// <summary> /// 去掉字符串中的非数字 /// </summary> /// <param name="target"></param> /// <returns></returns> public static string RemoveNotNumber(this string target) { return System.Text.RegularExpressions.Regex.Replace(target, @"[^\d]*", ""); } /// <summary> /// 去掉字符串中的非数字,保留小数点 /// </summary> /// <param name="target"></param> /// <returns></returns> public static string RemoveNotNumberAndDot(this string target) { return System.Text.RegularExpressions.Regex.Replace(target, @"[^\d.]*", ""); }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-30
  • 2021-12-26
  • 2022-02-13
  • 2021-07-29
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案