I have list def list = ['values.txt']
and I want to remove extension from filename and receive string . How I can do this ?
Expecting result is -- filename = 'values'
.
If you happen to open ANY Groovy book or tutorial you would find a lot of solutions.
For example:
def list = ['values.txt']
def noExtensions = list.collect{ it.split( /\./ )[ 0 ] }
assert ['values'] == noExtensions
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.