Solved

Sort for each loop by Time

Posted on 2014-01-31
3
300 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video discusses moving either the default database or any database to a new volume.

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now