Hi All,
I have an array of strings.
arrStrings = {“99M”,“99MY”,“Page2_99MY”,“Page2_99M”}
How to extract subarray with all 99M.
You can use this LINQ
arrFiltered = arrStrings.Where(Function(s) s.Contains("99M")).ToArray()
I have tried but it is also including all 99MY too
Ok if your 99M would be at the end then you can use this one.
arrFiltered = arrStrings.Where(Function(s) s.EndsWith("99M")).ToArray()
Can you try this
subArray = arrStrings.Where(Function(s) s.Equals("99M") OrElse s.StartsWith("99M_") OrElse s.EndsWith("_99M")).ToArray()
Regards,
Please try using regex which would check only for 99M
Arr.Where(function(x) System.Text.RegularExpressions.Regex.IsMatch(x,"\b99M\b")).ToArray
Cheers