按点(.)切分,必须要注意转义!如:split("\\."). 例子: public class Test { public static void main(String[] args) { String s = "adhahd.txt"; String t[] = s.split("\\."); for(int i = 0; i < t.length; i++){ System.out.println(t[i]); } } } publ…
这里面主要介绍一下关于String类中的split方法的使用以及原理. split函数的说明 split函数java docs的说明: When there is a positive-width match at the beginning of this string then an empty leading substring is included at the beginning of the resulting array.A zero-width match at the beg…