Scala: Removing first 2 directories from a String -


i have string looks "./path1/path2/path3/path4/etc/file"

i remove first 2 paths , return string looks this:

"path3/path4/etc/file"

how can using scala?

how simple: s.split("/").drop(3).mkstring("/")

in statement firstly split path /, next remove first 3 tokens (as first 1 . in case) , merge tokens create new path.


Comments