Groovy web console

subscribe to the feed Subscribe
to this
site
Groovy failure (via #groovywebconsole)
tweet this snippet Tweet
this
script

Groovy failure

Published 3 months ago by Brian
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
argsFiles = "-A suites/cifs/cifs_2008-r2_1-week-regression-cds.args -A suites/cifs/all.args"
def getSuiteName(argsFile) {
    int ind = argsFile.lastIndexOf(".args");
    if (ind>=0)
        argsFile = argsFile.substring(0, ind).toString()

    if (argsFile.count('_') >= 2) {
           tok = argsFile.tokenize('_')[1..-2]
           name = tok.join('_')
    } else {
        name = argsFile
    }

    return name
}

argLocation = argsFiles.tokenize()[1]
arg = argLocation.tokenize('/')[-1]
getSuiteName(arg)