java中 以“ ”切割字符串

public class App {

    public static void main(String[] args) {
        String str = "123\n456\n789\n";      //字符串"123
456
789
"
        String[] strs = str.split("\\n");
        for (String s : strs) {
            System.out.println(s);              //123   456 789
        }
    }

}
原文地址:https://www.cnblogs.com/zchok/p/11713585.html