1
Reply

Get the value of .Contains in C#

Ashwanikumar singh

Ashwanikumar singh

Jan 10 2018 10:51 AM
136
Hello guys,
I have one doubt, suppose i have a some string 
 Say for e.g "Hello world, i am a software developer"
Now I want to check if my string exists in above string then i want to extract that value.
e.g 
 
string mystring= "Hello world, i am a software developer"
if(mystring.Contains("software") || mystring.Contains("abc"))
{
   //here if software exists then store the software in below string
    string str= //here i want to store the value which i am checking i.e "software" if it exists
}
 
How do i do this...?
Can anybody tell me...??
Any help would be much appreciated
Thanks !!!

Answers (1)