1 /** 2 * 路径去掉空格 3 */ 4 public static void getPath(){ 5 String path = "C:/Users/v-guoxiao/Desktop/2-Particulars of the cited marks"; 6 path = path.replaceAll("\s*", ""); 7 System.out.println(path); 8 } 9 10 11 /** 12 * 分割字符串获取空值 13 */ 14 public static void getEndResult(){ 15 String string = "G1421089&@#16&@#C:/Users/v-guoxiao/Desktop/ReferenceNewFileWordPicture/商标3-16类/image2-4.jpg&@#HALO COFFEE LIMITED&@#2018-09-06&@#&@#"; 16 String[] sss = string.split("&@#",-1); 17 for(int i = 0; i < sss.length; i++){ 18 System.out.println("=============="+sss[i]); 19 } 20 }