MIke Lumley

MIke Lumley

  • NA
  • 16
  • 11k

Need to cut multiple strings from between 2 others in a textbox

Apr 18 2012 10:21 AM
Hi All,        
  I have some code as follows:

        string str = txtHTML2.Text;


        int start = str.IndexOf("first") /*+ "first".Length*/;

        int finish = str.LastIndexOf("last");

        string str2 = str.Substring(start,finish - start);

        listBox1.Items.Add(str2);

This copys the first ocurance between first\last to a listbox, what I need to do is to iterate through the whole textbox to the end because there is more to cut

Is there a way to do this? am I on the right path

any pointer to articales would be great

thanks in advance

Mike


           



Answers (5)