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

Popular posts from this blog

.htaccess - htaccess convert request to clean url and add slash at the end of the url -

php - facebook and github login HWIOAuthBundle and FOSUserBundle in Symfony2.1 -

hadoop - Sqoop installation export and import from postgresql -