I’m making an .Net Maui app where it takes photo of a plant/flower and then send it to PlantNet API and it returns a ‘scientific name’, I then compare this ‘scientific name’ into my database of plant/flowers with scientificName.
But here’s my problem – considering this code snippet, I need
string s = "Centaurea solstitialis L."; // this is from PlantNet API
string z = "Centaurea solstitialis, C. melitensis"; // this is from my database
// this returns 'false' but I need this to return true since they're the same scientific name
Console.WriteLine("z.Contains(s): " + z.Contains(s, StringComparison.Ordinal));
I did tried to use the
s.Contains(z, StringComparison.Ordinal)
and s.Contains(z)
and z.Contains(s)
but all returns false.