Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Groovy getTo()

class Example { 
   static void main(String[] args) { 
      // Example of an Integer using def 
      def rint = 1..10; 
      println(rint.getTo()); 
   } 
}

Groovy getFrom()

class Example { 
   static void main(String[] args) { 
      // Example of an Integer using def 
      def rint = 1..10; 
      println(rint.getFrom()); 
   } 
}

Groovy get()

class Example { 
   static void main(String[] args) { 
      // Example of an Integer using def 
      def rint = 1..10;
		
      println(rint.get(2)); 
      println(rint.get(4)); 
   } 
}

Groovy contains()

class Example { 
   static void main(String[] args) { 
      // Example of an Integer using def 
      def rint = 1..10; 
		
      println(rint.contains(2)); 
      println(rint.contains(11)); 
   } 
}

Groovy toLowerCase()

class Example { 
   static void main(String[] args) { 
      String a = "HelloWorld"; 
      println(a.toLowerCase()); 
   } 
}

Groovy toUpperCase()

class Example { 
   static void main(String[] args) { 
      String a = "HelloWorld"; 
      println(a.toUpperCase()); 
   } 
}

Groovy subString()

class Example { 
   static void main(String[] args) { 
      String a = "HelloWorld"; 
      println(a.substring(4)); 
      println(a.substring(4,8));
   }
}

Groovy split()

class Example {
   static void main(String[] args) {
      String a = "Hello-World";
      String[] str;
      str = a.split('-');
      
      for( String values : str )
      println(values);
   } 
}

Groovy Strings reverse()

class Example {
   static void main(String[] args) {
      String a = "Hello World";
      println(a.reverse());
   } 
}

Groovy replaceAll()

class Example { 
   static void main(String[] args) { 
      String a = "Hello World Hello"; 
      println(a.replaceAll("Hello","Bye")); 
      println(a.replaceAll("World","Hello"));     
   } 
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.