I have a couple of strings in an array.
For example:
[
"path/to/file",
"path",
"path/to/",
"path2/to/file",
"path2/to/file",
"path2/to"
]
etc...
The thing that i would like to achieve is to sort the array based on the the count of the slash. So the less count slashes on top.
So it would be like:
[
"path",
"path/to/",
"path2/to",
"path/to/file",
"path2/to/file",
"path2/to/file"
]