Grzesiek Zimnoch Grzesiek Zimnoch - 2 months ago 7
C# Question

c# how to write "if contains substring"?

Can someone tell me how it should look?

if (foundWord.value.Contains("przedaw".Substring(1, 7)))
{
for foundWord.value == "Sprzedawca" or "Sprzedawca:" or "Sprzedawca: " or "sprzedawca" etc...?
}


Thanks

Answer

You don't need substring here.

if (foundWord.value.Contains("przedaw"))

if you want to be case insensitive, you may use a ToLower()

if (foundWord.value.ToLower().Contains("przedaw"))