in among lots of html source i have some elements like this
<option value=15>Bahrain - Manama</option>
<option value=73>Bangladesh - Dhaka</option>
<option value=46>Barbados - Bridgetown</option>
<option value=285>Belarus - Minsk</option>
<option value=48>Belgium - Brussels</option>
<option value=36>Belize - Belmopan</option>
Also I have a dictionary declared like Dictionary<string, int> Places = new Dictionary<string, int>();
What I want to do it extract the City name out of the html and put it into of Places, and extract the number code out and put it into the int. For the first one I would add Placed.Add("Manama", 15);
The country name can get ignored. The idea though is to scan the html source and add the Cities automatically.
this is what I have so far
string[] temp = htmlContent.Split('\n');
List<string> temp2 = new List<string>();
foreach (string s in temp)
{
if (s.Contains("<option value="))
{
string t = s.Replace("option value=", "");
temp2.Add(t);
}
}
This cuts out some of the text but then I more or less get stuck wondering how to extract the relevant parts from the text. It's really bad I know but I'm learning :(