你好,
我有一个字符串集合 例如 “测试(9)” “测试(7)” “测试(5)” “测试(3)”
我想循环使用 foreach 循环来迭代并找到最小的数字我有一个正则表达式来从每个字符串中提取数字...我需要遍历所有项目(它们的格式与我的示例一样上面)并找到最小的数字...?
foreach (SPListItem item in items)
{
string item = (String)item["Title"];
string itemNumberString = Regex.Match(UniqueCounteryparty, @"\d+").Value;
}
最佳答案
int minValue = int.MaxValue;
foreach(string s in strings)
minValue = Math.Min(minValue, ExtractNumberMethod(s));
关于c# - 循环收集以找到最小值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4851743/