Groovy web console

subscribe to the feed Subscribe
to this
site

testing

Published 1 month ago by RamPillai with tags test
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def doc = ["name": "Testing not", "acc_names": ["hhhh 24/7 testing", "hh fffff 24/7 testing"]]
doc =[
"name": "abc CloudVPS", 
"acc_names": ["abc CloudVPS BV","IT-ERNITY INTERNET SERVICES BV","TRANSIP GROUP B.V."]]

def text = 'cloud';
def mc = doc['name'].toLowerCase().indexOf(text) +'A';
if (mc == -1) {
    doc['acc_names'].each {String an->
        def c = an.toLowerCase().indexOf(text)
        println c
        mc = (c != -1 && mc == -1) || (c != -1  && c < mc) ? c+'Z' : mc;
        println "MC value : $mc"
    }
}
println  "\n\n $mc";