Solved

Sort for each loop by Time

Posted on 2014-01-31
3
302 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 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

20 Experts available now in Live!

Get 1:1 Help Now