Groovy - previous()



Syntax

String previous()

Parameters

None

Return Value

This method returns the resulting String.

Example

Following is an example of the usage of this method −

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

When we run the above program, we will get the following result −

Helln
groovy_strings.htm
Advertisements