📜  如何在 Java 代码示例中拆分字符串

📅  最后修改于: 2022-03-11 14:52:32.991000             🧑  作者: Mango

代码示例6
String text = "Int--String";
String[] parts = text.split("--");
String part0 = parts[0];//"Int"
String part1 = parts[1];//"String"
System.out.println(part0/*"Int"*/ + " is a datatype for a number and a " + 
                  part1/*"String"*/ + " is a datatype for a text.");

// Output: Int is a datatype for a number and a String is a datatype for a text.