using System.Linq; namespace YBEE.EQM.Core; public static class StringExtensions { /// /// 清除空白字符 /// /// /// public static string ClearWhitespace(this string str) { if (str == null) { return null; } return string.Concat(str.Where(c => !char.IsWhiteSpace(c))); } /// /// 证件号码规范化处理 /// /// /// public static string IdNumberStdProcessing(this string str) { var nstr = ClearWhitespace(str) ?? ""; nstr = nstr.Replace("(", ")").Replace(")", ")").Replace("-", "-").Replace("——", "-"); return nstr.ToUpper(); } }