I need to find the part of the string between the two tags :
First tag <h3><a href="/questions/
Last tag " class
I'm trying to use indexof and substring but what should I do with the substring ?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MyString
{
public partial class Form1 : Form
{
private string htmlCode = "";
public Form1()
{
InitializeComponent();
var myString = GetSources();
int index = myString.IndexOf("<h3><a href=") + 11;
string restulr = myString.Substring(index, )
// <h3><a href="/questions/
// " class
}
private string GetSources()
{
using (WebClient client = new WebClient()) // WebClient class inherits IDisposable
{
htmlCode = client.DownloadString("https://myStringTest.com");
}
return htmlCode;
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
– Peter Duniho Sep 30 '20 at 20:46