What is Strings.reverse() in Groovy?

reverse() is a Groovy function that returns the reverse of the string passed as an argument.

Figure 1 shows a visual representation of the reverse() function.

Figure 1

Syntax


String reverse()

Parameters

The function takes in no parameters.

Return value

The function returns the modified string.

Code

class Main {
static void main(String[] args) {
String value = "Hello Edpresso";
println(value.reverse());
}
}

Output


osserpdE olleH

Free Resources