本文实例报告了C#基于正则表达式删除字符串中数字或非数字的要领。分享给人人供人人参考,细致以下:
/// 去掉字符串中的数字 public static string RemoveNumber(string key) { return Regex.Replace(key, @"\d", ""); } //去掉字符串中的非数字 public static string RemoveNotNumber(string key) { return Regex.Replace(key, @"[^\d]*", ""); }
以上就是C#基于正则表达式怎样删除字符串中数字或非数字的要领详解的细致内容,更多请关注ki4网别的相干文章!