Groovy web console

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

basics

Published 5 months ago by jag with tags basics
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
class Groovyt {
  public void main (String[] args) {
     def a = [1:"a", 2:"b"]
     println(a)
     println(a.size())
     a.remove(1)
     println(a.size())
     println(Integer.MAX_VALUE)
     println(Integer.MIN_VALUE)
     println(Math.PI)
     println(new Random().nextInt())
     def b = "hello"
     println(b[-9..-1])
     println(b[0,2,4])
     println(b.substring(2,4))
     def c = 'how are you'
     println(b.concat(" " + c) * 2)
     println("1".equals("1"))
     println(c.length())
     def full_name = b.concat(c)
     println(full_name)
     def d = '''Skipper is a lightweight tool that allows you to discover Spring Boot applications and manage their lifecycle on multiple Cloud Platforms. You can use Skipper standalone or integrate it with Continuous Integration pipelines to help implement the practice of Continuous Deployment.'''
     def line_list = d.split(" ")
     for (item in line_list) {
            println(item.toLowerCase())
            println(item.toUpperCase())
        }
     println(d.replaceAll("S", "#"))
     println("1" <=> "2")
     println("2" <=> "1")
     println("1" <=> "1")
     def m_list = [1,5,6,7,8,10,100]   
     println(m_list)
     
  }
}