c# find words in sequence in richtextbox -


i have 2 rich text boxes. first text box contains input , second text box display output of found words

input: name umer father name waqar

output:

umer found found name found is found father found found 

the output not want. i want output below:

my found name found is found umer found found father found name found is found waqar found 

my code is:

 private void button1_click(object sender, eventargs e)         {            if (richtextbox1.text.contains("umer"))             richtextbox2.appendtext("\numer found");              if (richtextbox1.text.contains("my"))             richtextbox2.appendtext("\nmy found");              if (richtextbox1.text.contains("name"))             richtextbox2.appendtext("\nname found");              if (richtextbox1.text.contains("is"))             richtextbox2.appendtext("\nis found");              if (richtextbox1.text.contains("father"))                 richtextbox2.appendtext("\nfather found");              if (richtextbox1.text.contains("waqar"))                 richtextbox2.appendtext("\nwaqar found");         } 

this required :

 string[] words = richtextbox1.text.split(' ');         foreach (string searchstring in words)  {       if (richtextbox1.text.contains(searchstring))       {          richtextbox2.appendtext(searchstring + " found.\n");       }  } 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -