Splits this string around matches of the given regular expression.
Syntax
String[] split(String regex)
Parameters
regex – the delimiting regular expression.
Return Value
It returns the array of strings computed by splitting this string around matches of the given regular expression.
Example
Following is an example of the usage of this method −
class Example { static void main(String[] args) { String a = "Hello-World"; String[] str; str = a.split('-'); for( String values : str ) println(values); } }
When we run the above program, we will get the following result −
Hello World
Previous Page:-Click Here
Pingback: Groovy - Strings - Adglob Infosystem Pvt Ltd
I am so grateful for your blog post.Much thanks again. Fantastic.