关于split切割的几种情况

public class splitTest {

    public static void main(String[] args) {
        String a = "@123";
        String b = "123@";
        String c = "3@@@";
        String[] aArr = a.split("@"); //[,123]
        String[] bArr = b.split("@"); //[123]
        String[] arr = c.split("@");
        System.out.println(arr.length);
        
        String d = "1";
        String[] dArr = a.split("1");  //[]
        String e = "12";
        String[] eArr = a.split("1"); //[,2]
    }
}

 

posted @ 2021-02-28 12:38  信铁寒胜  阅读(181)  评论(0编辑  收藏  举报