// 通过空格,逗号 来进行切分数据
String mo = " /t MO23082600914 /t/n MO23082600907"
if (Pattern.compile("[\\s,]").matcher(mo).find()){
// 删除特殊字符
mo = mo.replaceAll("\r|\n|\t", "");
// 移除首位空格
mo = mo.trim();
// 进行切割
String[] moArr = mo.split("[\\s,]+");
List<String> list = Arrays.asList(moArr);
}
JAVA字符串正则匹配移除特殊字符
于 2023-08-30 09:34:23 首次发布