Groovy – getAt()

  • Post author:
  • Post category:Groovy
  • Post comments:0 Comments
Following is an example of the usage of this method

In this section, we will discuss, get method in Groovy.

Syntax

String getAt(int index)

Parameters

  • Index โ€“ The position of the string to return

Return Value

String value at the index position

Example

Following is an example of the usage of this method โˆ’

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

When we run the above program, we will get the following result โˆ’

l 
W 
O

Previous Page:-Click Here

Leave a Reply