Please support our C# advertiser: Programming Forums
Views: 434 | Replies: 1
![]() |
•
•
Join Date: Jul 2007
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
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!
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.
csharp Syntax (Toggle Plain Text)
string s = "Hello World!"; if ( s.Contains( "Hello" ) ) { Console.WriteLine( "Found \"Hello\" in the string" ); }
The truth does not change according to our ability to stomach it.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)





Linear Mode