hello to all!!
my name is Alex, i started with progeamming a few days ago, now i got to do this console application and i dont know how i can find and compare one word inside a sentence:
fro example:
"Hello World!"
how can i check if the word "Hello" appears in the text?

for now i managed only to ceate something that compares if the string is identical or not, but thats not good enough.

i'm very new in this so i will apreciate the patiance!

Use the Contains method of the string class to find substrings.

string s = "Hello World!";

if ( s.Contains( "Hello" ) ) {
  Console.WriteLine( "Found \"Hello\" in the string" );
}
commented: exactly what i was going to post. +6
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.