Hi There,

Proberly a really simple request but im desperate for help none the same lol,

I need to write some code that, takes filenames from a folder, and displays them in an order in a list. (Im using Visual Studio btw) lol.

The file names are in the format of


The last four digits the time, middle set the date. Currently my code can read these file names and saves them as strings however i need to display them in time/date order, most recent first.

What is the best way to go about this?

Thanks in advance

6 Years
Discussion Span
Last Post by gusano79

the best option would be to use the string split method as ddanbe suggested,
when you do so, instead of an array size of 3 that you expect it to be, you would also get a empty string array at index 0, may be u can use the trim method or make sure you handle that in the loop.



The last four digits the time, middle set the date.

How is 3215 the time?? What it represents? Seconds?
Because 32hours and 15 minutes cannot be in one day!


A simple Split is fine if all you have to do is split at the underscores and pass the parts off to date/time parsers, but it starts to get messy if you have to do more text manipulation after the split.

This might be slightly overkill for the posted problem, but I suggest you become familiar with regular expressions (if you aren't already) as something to keep in mind for when you have to parse formatted text that isn't dead simple.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.