📜  java 拆分字符串 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:14.743000             🧑  作者: 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.