Groovy web console

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

Untitled

Published 5 months ago by Anonymous
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def input = "AA3BBCD10"

def whatMultyplays = input.findAll("[\\w{1}][\\d]+")
def output = input

for (whatMultyplay in whatMultyplays){
    def replace = whatMultyplay[0] * whatMultyplay.substring(1).toInteger()
    output = output.replace(whatMultyplay, replace)
    
}

println(output)