java String split

DEMO:

竖线:

1 String str ="s|345";
2 String[] array = str.split("\\|");
3 System.out.println(array.length);

换行:

1 String[] array = str.split("\r\n");

 斜杠:

String ip = "/127.0.0.1";
System.out.println(ip.replaceAll("/", ""));

 

posted @ 2016-01-16 19:36  xiluhua  阅读(176)  评论(0编辑  收藏  举报