字符串中含有“.”,且需要对其进行分割。下面语句得到的结果为空数组。
String s[] = str.split(".");
必须经过转义之后才可以进行正常分割,所以应该写成:
String s[] = str.split("\\.");