Ich habe eine Reihe von Zeichenfolgen. Ich möchte mit der Saite vergleichen, die ich von JSON bekomme. Vergleich sollte so sein. Zum Beispiel: Wenn der Kontoname in einer Zeichenfolge Google und in anderen die Google Inc ist, dann sollte Google übereinstimmen, da Google Teil des Firmennamens von Google Inc. ist. Sonst nicht.String-Matching in C#
-Code, den ich geschrieben habe:
for (int i = 0; i < accountCount; i++)
{
//// account is found in the array
name[i] = account.Entities[i].Attributes["name"].ToString();
if (name[i] == message.Current.org_name)
{
flag = 1;
c.CreateOpportunity(message);
break;
}
}
//// account is not found in the array
if (flag == 0)
{
c.CreateAccount(message);
c.CreateOpportunity(message);
}
[ 'String.IndexOf'] (https : //msdn.microsoft.com/en-us/library/k8b1470s.aspx) und ['String.Contains'] (https://msdn.microsoft.com/en-us/library/dy85x1sa (v = vs. 110) .aspx) sind deine Freunde. – lamandy
Ich nehme an, du willst 'if (name [i] .Contains (mySearchString))'. – HimBromBeere
@HimBromBeere ya das ist perfekt – vidhi