Solved

Sort for each loop by Time

Posted on 2014-01-31
3
304 Views
Last Modified: 2014-02-11
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
Comment
Question by:runnerjp2005
  • 2
3 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39823830
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
 

Author Comment

by:runnerjp2005
ID: 39823987
Thats a great idea.... how would i order it 1- 45 then ht then 46 - 90???
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 39824246
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question