What is substring(int beginIndex) in Groovy?

substring(int beginIndex) is a Groovy function that pads a string with the spaces added to the right.

Syntax


String substring(int Index)

Parameters

The function takes in one parameter, Index. This is the beginning index.

Return value

The function returns the specified substring.

Code

class Main {
static void main(String[] args) {
String result = "Edpresso";
println(result.substring(4));
}
}

Output


esso

Free Resources