int limit, , n. , String , .

"o" (regex) String. D2 E2, L2 M2. null "o" "o", "".
- String ( M2) "" String. , String, "" String.
, String :
string[0] ---> contains ---> "b"
string[1] ---> contains ---> ""
string[2] ---> contains ---> ":and:f"
string[3] ---> contains ---> ""
string[4] ---> contains ---> ""
splitted_string.
split(regex, 0) split(String regex) String , . , , L4 N4 String, . :
String str = "boo:and:foo";
String[] a = str.split("o", 0);
for (String x : a)
System.out.println("split(\"o\", 0)\t = " + x);
String[] b = str.split("o");
for (String x : b)
System.out.println("split(\"o\")\t= " + x);
OUTPUT
split("o", 0) = b
split("o", 0) =
split("o", 0) = :and:f
split("o") = b
split("o") =
split("o") = :and:f
docs:
n , n - 1 , n, .
1:
String str = "boo:and:foo";
String[] a = str.split("o", 2);
System.out.println("Length = " + a.length);
for (String x : a)
System.out.println("split(\"o\", 2)\t = " + x);
OUTPUT
Length = 2
split("o", 2) = b
split("o", 2) = o:and:foo
n - 1 , .. 2 - 1 = 1 . , "o".
2:
String[] b = str.split("o", 7);
System.out.println("Length = " + b.length);
for (String x : b)
System.out.println("split(\"o\", 7)\t = " + x);
OUTPUT
Length = 5
split("o", 7) = b
split("o", 7) =
split("o", 7) = :and:f
split("o", 7) =
split("o", 7) =
"o", n - 1 , .. 7 - 1 = 6 . - , "o", "o" .
split(regex, 0) split(regex), String, .. "".
:
n , , .
, split(regex, 0) split(regex), String. :
String str = "boo:and:foo";
String[] a = str.split("o", -1);
System.out.println("Length = " + a.length);
for (String x : a)
System.out.println("split(\"o\", -1)\t = " + x);
OUTPUT
Length = 5
split("o", -1) = b
split("o", -1) =
split("o", -1) = :and:f
split("o", -1) =
split("o", -1) =
, splitted_string.