Link to home
Start Free TrialLog in
Avatar of Member_2_5230414
Member_2_5230414

asked on

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
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

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.
Avatar of Member_2_5230414
Member_2_5230414

ASKER

Thats a great idea.... how would i order it 1- 45 then ht then 46 - 90???
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial