Groovy – Strings reverse()
Creates a new String which is the reverse of this String. Syntax String reverse() Parameters None Return Value This method returns the resulting String. Following is an example of the…
Groovy
Creates a new String which is the reverse of this String. Syntax String reverse() Parameters None Return Value This method returns the resulting String. Following is an example of the…
Replaces all occurrences of a captured group by the result of closure on that text. Syntax void replaceAll(String regex, String replacement) Parameters regex − the regular expression to which this string…
In this section, we will discuss the previous() method in groovy. Syntax String previous() Parameters None Return Value This method returns the resulting String. Example Following is an example of…
Appends a String Syntax String plus(Object value) Parameters Value − The object to append to the string Return Value This method returns the resulting String. Example Following is an example of…
Pad the String with the spaces appended to the right. This method has 2 different variants. String padRight(Number numberOfCharacters) − Pad the String with the spaces appended to the right. Syntax…
Pad the String with the spaces appended to the left.This method has 2 different variants. String padLeft(Number numberOfCharacters) − Pad the String with the spaces appended to the left. Syntax String…
This method is called by the ++ operator for the class String. It increments the last character in the given String. Syntax String next() Parameters None Return Value The new…
Removes the value part of the String. Syntax String minus(Object value) Parameters Value – the string object which needs to be removed Return Value The new string minus the value…
It outputs whether a String matches the given regular expression. Syntax Boolean matches(String regex) Parameters Regex − the expression for comparison. Return Value This method returns true if, and only if,…
Returns the index within this String of the first occurrence of the specified substring. This method has 4 different variants. public int indexOf(int ch) − Returns the index within this string…