The "What I have tried:" section is where you are meant to put the code that you have tried.
Quote:
I have tried using sub string. But position of image tags are not aligned.
I have no idea what you mean by "not aligned"
First you need to know where the img tag starts - that is simply a case of using the
IndexOf [
^] method.
Once you know where it starts, you can re-use an overload of IndexOf to find the end tag ">"
Then you can use those positions to remove the text between those points using overloads of
Substring[
^] to reconstruct the string from beginning of the string to the start of the first img tag combined with the part of the string that starts 1 character past the end of the img tag to the end of the string. E.g.
int start = html.IndexOf(@"<img");
int stop = html.IndexOf(@">", start + 1);
html = string.Format("{0}{1}",html.Substring(0, start),html.Substring(stop +1))
Quote:
Note - There May be multiple IMAGE TAGS in above string.
Then put this into a loop that removes imgs until there are no more img tags - Hint - use while rather than do in case there are no imgs in the string when you start.