Groovy web console

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

GroovyTest

Published 4 months ago by Shimpali with tags new test
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
class Groovytut{
static void main(String [] args)
{
    def s= "ABC";
    def h='''I am a string
    which is not 
    in just one line.''';
    def rep= "What I said" *2;
    println("I am $s");
    println("I am ${s}");
    println(h);
    println ("3rd Index: "+ s[1]);
    println ("Index of B:" + s.indexOf('B'));
    println ("Equals:" + ('ABC'.equals('ABC')));
    println ("Equals:" + ('ABC'.equalsIgnoreCase('abc')));
    println("Length:" +s.length());
    println(rep - "What");
    println(rep.split(''));
    println(rep.toList());
    println(rep.replaceAll('I', 'She'));
    println("UpperCase: " +rep.toUpperCase());
    println("LowerCase: " +s.toLowerCase());
}
}