HI,
I have a collection of strings
eg
“test (9)”
“test (7)”
“test (5)”
“test (3)”
I want to loop use a foreach loop to iterate and find the lowest number I have a regex to extract the number out of each string… I need to loop through all items (which are in the format as in my example above) and find the lowest number…?
foreach (SPListItem item in items)
{
string item = (String)item["Title"];
string itemNumberString = Regex.Match(UniqueCounteryparty, @"\d+").Value;
}
I’m initializing the variable “test” below using array initialization syntax for demo purposes since I’m assuming you have a collection already populated with the strings you need.
“ExtractNumber” is your function that extracts the number from the string