正则表达式
作者:互联网
分割字符串
private static final Pattern NAME_SEPARATOR = Pattern.compile("\\s*[,]+\\s*");
public static void main(String[] args) {
String[] names = NAME_SEPARATOR.split("hah , ahe ,h e");
Arrays.stream(names).forEach(System.out::println);
}
hah
ahe
h e
标签:hah,String,ahe,正则表达式,Pattern,static,names 来源: https://www.cnblogs.com/lanqie/p/10825756.html