split()
is a function in groovy that splits the String
around matches of the given regular expression.
String[] split(String regex)
The function takes in one parameter regex
.
regex
is the delimiting regular expression.
The function returns the array of strings calculated by splitting the string around matches of regex
.
class Example {static void main(String[] args) {String val_one = "Hello-Edpresso";String[] str;str = val_one.split('-');for( String val : str )println(val);}}
Hello
Edpresso