String.split()
Signature
String[] split(String str, String regex)
Domain
action, condition, query
Description
Splits this string around matches of the given regular expression.
Trailing empty strings are not included in the resulting array.
Parameters
Name | Type | Description |
str | String | A String to be splitted. |
regex | String | the delimiting regular expression. |
Returns
Type | Description |
String[] | the array of strings computed by splitting this string around matches of the given regular expression. |
Example
String[] result = String.split("This,is,a,test", ",");
Result is:
result = {"This", "is", "a", "test" } .
String[] result = String.split("This|is|a|test", "\\|");
Result is:
result = {"This", "is", "a", "test" } .