Re: Using Array.FindAll
- From: Göran Andersson <guffa@xxxxxxxxx>
- Date: Wed, 30 Jul 2008 02:27:01 +0200
Jerry Spence1 wrote:
I'm using VB2005
I have an array of some 500,000 items which are of the form 080715_175327_312.jpg. These are camera frames of the form YYMMDD_HHmmss_ms.jpg
I want to create another array which contains all the items which are (> 080715_1730) and (< 080716_0810)
What is the fastest way? I've found FindAll and IndexOf, but I can't work out how to do it.
Thanks
-Jerry
Fortunately you have used an ISO 8601 like date format, which means that the strings can be compared without having to parse each single value into a DateTime value.
If the array is sorted, you can use the Array.BinarySearch method to find the first and the last item. That would be very much faster than looping through all the items.
If the array is not sorted, you have to loop. If you want to use the FindAll method for that, you need a method like this to do the comparison:
Function Compare(value As String) As Boolean
Return value > "080715_1730" And value < "080716_0810"
End Function
--
Göran Andersson
_____
http://www.guffa.com
.
- Follow-Ups:
- Re: Using Array.FindAll
- From: Jerry Spence1
- Re: Using Array.FindAll
- Prev by Date: Re: Dynamically getting images from Database and displaying on ASP.Net page
- Next by Date: Crystal Reports Help
- Previous by thread: webbrowser can not find the website in localhost
- Next by thread: Re: Using Array.FindAll
- Index(es):
Relevant Pages
|