what is the most efficient way to get one directory tree level up ?
i am looking for most efficient use of string class method to
getting e:\files\report\fruits from e:\files\report\fruits\apples
what is the most efficient way to get one directory tree level up ?
Share
I think you are better off just using
If you insist on using String only and assuming ‘\’ is the path separator, you can do something like this:
But you have to beware of edge cases like there being no character ‘\’ found.