BufferedReader: read multiple lines into a single string

后端 未结 7 1114
逝去的感伤
逝去的感伤 2021-01-17 11:22

I\'m reading numbers from a txt file using BufferedReader for analysis. The way I\'m going about this now is- reading a line using .readline, splitting this string into an a

7条回答
  •  太阳男子
    2021-01-17 11:48

    Sounds like you want Apache IO FileUtils

    String text = FileUtils.readStringFromFile(new File(filename + ".txt"));
    String[] stringArray = text.split("[^0-9.+Ee-]+");
    

提交回复
热议问题