• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 315
  • Last Modified:

Sort for each loop by Time

Hi guys ... i have a foreach loop that works but what i want to do is order it by time

so at the moment the output looks like this:


26 Maccabi Sha&#;arayim 3900 - 0 Maccabi Ironi Amishav Petah Tikva
70 Hapoel Migdal HaEmek 0 - 0 FC Ahva Arraba
HT Mes Kerman 0 - 1 Esteghlal Tehran Boom!
66 Rah Ahan 0 - 0 Saba Qom
1 Al-Baten 0 - 0 Uhud

But i want it order like this

1 Al-Baten 0 - 0 Uhud
26 Maccabi Sha&#;arayim 3900 - 0 Maccabi Ironi Amishav Petah Tikva
HT Mes Kerman 0 - 1 Esteghlal Tehran Boom!
66 Rah Ahan 0 - 0 Saba Qom
70 Hapoel Migdal HaEmek 0 - 0 FC Ahva Arraba

For Each div As Object In htmlDoc.DocumentNode.SelectNodes(".//div[@class='matches']")

' bumph goes here
 

		  end if

        Next

Open in new window


i have broke down the code above just to show the while loop.... it would need to be orderd by
Div.selectSingleNode(".//td[@class='time']").InnerText.Trim().Substring(0, 2)

Open in new window


getting the first two digits being the minutes or HT


any ideas how I can do this as I have searched google and found nothing... also the the HT being between 45 and 46 this makes it a little trickey
0
runnerjp2005
Asked:
runnerjp2005
  • 2
1 Solution
 
CodeCruiserCommented:
One option would be to create a dictionary with minutes as the key and rest of the string as the value. You can then sort keys.
0
 
runnerjp2005Author Commented:
Thats a great idea.... how would i order it 1- 45 then ht then 46 - 90???
0
 
CodeCruiserCommented:
You can use two dictionaries. If time value falls between 1-45 then add to dictionary1 and add to dictionary2 otherwise. Or you can use 1 dictionary but check the value when retrieving it.
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now