I can have two cases of the string line.
string mystring = "/aaa/bbb/ccc/ddd/eee"
and
string mystring2 = "aaa/bbb/ccc/ddd/eeee/";
Of course I can use a split by ‘/’ and do some checks, but I am looking for some elegant solution.
if i do mystring.Split(‘/’) it can be on 2nd or 3rd position in array, how do I know where it is?
How do I get ‘ccc’ ?
THanks!
You could do something like:
Then,
resultandresult2would be the same.