Say I have something like this:
new File(\"test\").eachFile() { file->
println file.getName()
}
This prints the full filename of eve
I believe the grooviest way would be:
file.name.lastIndexOf('.').with {it != -1 ? file.name[0..
or with a simple regexp:
file.name.replaceFirst(~/\.[^\.]+$/, '')
also there's an apache commons-io java lib for that kinda purposes, which you could easily depend on if you use maven:
org.apache.commons.io.FilenameUtils.getBaseName(file.name)