replaceAll()
is a function in groovy that replaces all occurrences of a string with a specified string.
void replaceAll(String text, String replace)
text
: the string that needs to be replaced.
replace
: the string which would replace text
.
This method returns the modified String
.
class Main {static void main(String[] args) {String text = "Hello Educative Hello";println(text.replaceAll("Hello","Edpresso"));}}
Edpresso Educative Edpresso