[Solved] Pasing a line and getting values [closed]


I’m assuming the input is Java. To simply extract the values, you can do

    String str = "rtt min/avg/max/mdev = 10.876/13.344/17.155/2.736 ms";

    String[] strings = str.split(" "); // split string on spaces, 5 new strings
    str = strings[3]; // select the 4th of these strings

    strings = str.split("https://stackoverflow.com/"); // split again, this time on "https://stackoverflow.com/"

    double min = Double.parseDouble(strings[0]);
    double avg = Double.parseDouble(strings[1]);
    double max = Double.parseDouble(strings[2]);
    double deviation = Double.parseDouble(strings[3]);

Then remains to parse them as jsp and put them in a file. I hope this gets you started on the problem. (PS: I haven’t put the code in a method, as I don’t know exactly how you will be using it.)

1

solved Pasing a line and getting values [closed]