What is the best code for comparing 2 comma separated strings and retrieving values that intersect? For instance lets say I have string "a,b,c" and the target string "x,b,y", I need result saying there is 1 occurrence.
As suggested here One way of doing this is
public static bool UserCanAccessThisPage(string userAccessGroups,
string pageItemAccessGroups)
{
return userAccessGroups.Split(',')
.Select(s => s.Trim())
.Contains(pageItemAccessGroups);
}
But this will only check the match but I do also need occurrences. Any suggestions please