Commit 11256e4a 张东亮

规则选中必须为数字时,将字符串内非数字字符剔除

1 个父辈 a6ca39ce
...@@ -712,7 +712,8 @@ namespace BLL ...@@ -712,7 +712,8 @@ namespace BLL
var filtercode = code.Substring(startIndex, length); var filtercode = code.Substring(startIndex, length);
if (codeMatch[i].MatchISNumber) if (codeMatch[i].MatchISNumber)
{ {
if (!int.TryParse(filtercode, out int res)) string numStr= System.Text.RegularExpressions.Regex.Replace(filtercode, @"[^\d]*", "");
if (!int.TryParse(numStr, out int res))
ismatch = false; ismatch = false;
filtercode = res.ToString(); filtercode = res.ToString();
MatchAnalysis.AddMatch(codeMatch[i].Keyword, ismatch, codeMatch[i].CodeID, $"是否为数字", $"NG"); MatchAnalysis.AddMatch(codeMatch[i].Keyword, ismatch, codeMatch[i].CodeID, $"是否为数字", $"NG");
......
...@@ -761,7 +761,8 @@ namespace SmartScan ...@@ -761,7 +761,8 @@ namespace SmartScan
var filtercode = code.Substring(startIndex, length); var filtercode = code.Substring(startIndex, length);
if (codeMatch[i].MatchISNumber) if (codeMatch[i].MatchISNumber)
{ {
if (!int.TryParse(filtercode, out int res)) string numStr = System.Text.RegularExpressions.Regex.Replace(filtercode, @"[^\d]*", "");
if (!int.TryParse(numStr, out int res))
ismatch = false; ismatch = false;
filtercode = res.ToString(); filtercode = res.ToString();
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!