Код: Выделить всё
using System;
using System.Text;
using System.Linq;
public class Program
{
public static void Main()
{
string Company = "Foundation Medicine, Inc.";
string CompanyRemoveValues = "Ltd;inc;inc.;,";
var RemoveValues = CompanyRemoveValues.ToLower().Split(';').ToList();
string[] companyParts = Company.ToLower().Split(new Char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
StringBuilder Sb = new StringBuilder();
foreach (string part in companyParts)
{
if (!RemoveValues.Contains(part))
{
Sb.Append(part);
Sb.Append(" ");
}
}
string Search = Sb.ToString();
Console.WriteLine("Keyword");
Console.WriteLine(Search);
}
}
https://dotnetfiddle.net/WpALaV
Подробнее здесь: https://stackoverflow.com/questions/786 ... ove-values