- java的split()方法用于字符串中根据指定的字符进行分割,得到的是一个字符串数组
public String[] split(String regex) Splits this string around matches of the given regular expression.split() 方法需要的参数不是一个简单的字符,而是正则表达式
- 当以"."作为分割符时,不能使用s.split(".") ,而要使用s.split("\\.")
- 当以"|"作为分割符时,不能使用s.split("|") ,而要使用s.split("\\|")
- * + 由于不是正确的模式匹配表达式,因而也需要转义
- 如果在一个字符串中有多个分隔符,可以用“|”作为连字符,比如,“acount=? and uu =? or n=?”,把三个都分隔出来,可以用String.split("and|or");