Java read values from text file

后端 未结 2 1870
-上瘾入骨i
-上瘾入骨i 2021-01-12 10:44

I am new to Java. I have one text file with below content.

`trace` -
structure(
 list(
  \"a\" = structure(c(0.748701,0.243802,0.227221,0.752231,0.261118,0.263         


        
2条回答
  •  孤独总比滥情好
    2021-01-12 11:09

    You can play with split. First find the line in the text that matches "a" (or "b"). Then do something like this:

    Array[] first= line.split("("); //first[2] will contain the values
    

    Then:

    Array[] arrayList = first[2].split(",");
    

    You will have the numbers in arrayList[]. Be carefull with the final brackets )), because they have a "," right after. But that is code depuration and it is your mission. I gave you the idea.

提交回复
热议问题