- package daysreplace;
-
- public class SplitTest {
- public static void main(String[] args) {
-
- String str="武汉市|孝感市|长沙市|北京市|上海市";
-
- String[] array = str.split("\\|");
-
- System.out.println(array[0]);
- System.out.println(array[1]);
- System.out.println(array[2]);
- System.out.println(array[3]);
- System.out.println(array[4]);
-
-
- }
-
-
- }