I want to check whether Value1 below contains \"abc\" within the first X characters. How would you check this with an if statement?
Adding on from the answer below i have created this method:
public static bool ContainsInvalidStrings(IList invalidStrings,string stringToCheck)
{
foreach (string invalidString in invalidStrings)
{
var index = stringToCheck.IndexOf(invalidString, StringComparison.InvariantCultureIgnoreCase);
if (index != -1)
{
return true;
}
}
return false;
}
it can be used like this:
var unsupportedTypes = new List()
{
"POINT Empty",
"MULTIPOINT",
"MULTILINESTRING",
"MULTIPOLYGON",
"GEOMETRYCOLLECTION",
"CIRCULARSTRING",
"COMPOUNDCURVE",
"CURVEPOLYGON",
"MULTICURVE",
"TRIANGLE",
"TIN",
"POLYHEDRALSURFACE"
};
bool hasInvalidValues = ContainsInvalidStrings(unsupportedTypes,possibleWKT);
you can check for multiple invalid values this way.