An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
Hi @Jonathan
Please try the below method will achieve the your result.
public static double WordMatchPercentage(string a, string b)
{
var words1 = a.ToLower().Split(' ', ',', '.')
.Where(x => !string.IsNullOrWhiteSpace(x))
.ToHashSet();
var words2 = b.ToLower().Split(' ', ',', '.')
.Where(x => !string.IsNullOrWhiteSpace(x))
.ToHashSet();
int matched = words1.Intersect(words2).Count();
int maxWords = Math.Max(words1.Count, words2.Count);
return (double)matched / maxWords * 100;
}
Thanks.