Converts a path string, or a sequence of strings that when joined form a path string, to aPath
....APath
representing an empty path is returned if first is the empty string and more does not contain any non-empty strings.
In Groovy, to print a variable number of arguments, the code is below.
import java.nio.file.*
String joinPath(String first, String... args){
Path path = Paths.get(first, args)
path.toString()
}
println joinPath('a')
println joinPath('a', 'b', 'c')
println joinPath('~/Data')
No comments:
Post a Comment