c# – How to scan a string and check content inside it?


I need to do a check with a certain text inside a string . How do I iterate through this string and look for the text to do this check?


If(dentro da string contém "Olá")
   Mostre o valor determinado para essa string;


Use the Contains() method to find out if a text is present inside another:

if ("Olá Mundo".Contains("Olá")) {
    //Faça o que quer aqui

I put it on GitHub for future reference .

Scroll to Top