package com.hjp.test;
/**
* 当split 遇到特殊字符
* @author huangjp
*/
public class AboutSplit {
public static void main(String[] args) {
String str = "123|456\\abc.dfg*asd^bnm";
String[] splitArr = new String[100];
splitArr = str.split("[|]");
splitArr = str.split("\\|");
splitArr = str.split("\\\\");
splitArr = str.split("\\^");
splitArr = str.split("[.]");
splitArr = str.split("\\.");
splitArr = str.split("[*]");
splitArr = str.split("\\*");
System.out.println(splitArr[0]);
}
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31