Description:
This method has two variants and splits this string around matches of the
given regular expression.
Syntax:
Here is the syntax of this method:
public String[] split(String regex, int limit)
or
public String[] split(String regex)
Parameters:
Here is the detail of parameters:
regex -- the delimiting regular expression.
limit -- the result threshold which means how many strings to be returned.
Return Value:
It returns the array of strings computed by splitting this string around matches of the given regular expression.
Example:
import [Link].*;
public class Test{
public static void main(String args[]){
String Str = new String("[Link]");
[Link]("Return Value :" );
for (String retval: [Link]("-", 2)){
[Link](retval);
}
[Link]("");
[Link]("Return Value :" );
for (String retval: [Link]("-", 3)){
[Link](retval);
}
[Link]("");
[Link]("Return Value :" );
for (String retval: [Link]("-", 0)){
[Link](retval);
}
[Link]("");
[Link]("Return Value :" );
for (String retval: [Link]("-")){
[Link](retval);
}
}
}
This produces the following result:
Return Value :
Welcome
[Link]
Return Value :
Welcome
to
[Link]
Return Value:
Welcome
to
[Link]
Return Value :
Welcome
to
[Link]