您可以使用
BufferedReader或任何IO类读取文件。假设
testing.txt文件中包含该字符串,然后从文件中读取每一行,则可以使用分隔符(
+)进行分割。并遍历数组并打印。
BufferedReader br = null; try { String sCurrentLine; br = new BufferedReader(new FileReader("C:\testing.txt"));//file name with path while ((sCurrentLine = br.readLine()) != null) { String[] strArr = sCurrentLine.split("\+"); for(String str:strArr){ System.out.println(str);} } } catch (IOException e) { e.printStackTrace(); } finally { try { if (br != null)br.close(); } catch (IOException ex) { ex.printStackTrace(); } }


