Hi,
This is vaguely related to my last post, but not entirely so I'll make a new one. Hope that's consistent with the board rules :)
I have a path
String path = "C:\\test\another\\directory\\";
It seems the trailing slash is appended automatically when using the OpenFileDialog, so I used to in the initialization of the variable too.
Now, in order to go down one directory when the user double clicks the ".." in my ListBox, I (after a good nudge in the right direction) split the parts of the string up using
string[] subPaths = path.Split('\\');
Now, here's the problem:
With this split, I end up with an empty string in the array (the last one). This is ok as I know, the way I implemented it, that it will always be an empty string there, but:
1. I hate leaving stuff that could introduce bugs
2. I hate "just leaving it as it is because it's comfortable".
So, the question is this:
1. Is it possible to tell Split to leave out empty strings?
2. Is it possible to cast the outcome of Split to an ArrayList, and then check the last string and delete it if it's empty?
Cheers!