Sorting a text file by date - Date looks like DD/MM/YYYY

Posted by John N on Stack Overflow See other posts from Stack Overflow or by John N
Published on 2010-04-12T18:17:13Z Indexed on 2010/04/12 18:23 UTC
Read the original article Hit count: 343

Filed under:
|
|

I am trying to sort the dates from the earliest to the latest. I was thinking about using the bufferedreader and do a try searching the first 2 characters of the string and then the 4th and 5th characters and finally the 7th and 8th characters, ignoring the slashes.

The following is an example of the text file I have:

04/24/2010 - 2000.0 (Deposit)

09/05/2010 - 20.0 (Fees)

02/30/2007 - 600.0 (Deposit)

06/15/2009 - 200.0 (Fees)

08/23/2010 - 300.0 (Deposit)

06/05/2006 - 500.0 (Fees)

© Stack Overflow or respective owner

Related posts about java

Related posts about sorting