I have this from text file:
134.897 134.4565 135.134
I read them using :
while (( line = buffreader.readLine()) != null) {
String[] parts = line.split(" ");
String x1 = (parts[0]);
String x2 = (parts[1]);
String x3 = (parts[2]);
From the String in the text file :
134.897
134.4565
135.134
I just want to take the **different number** between these three number :
4.897
4.4565
5.134
Given more example :
Text file :
101.435
101.423
101.322
Number I want to take :
435
423
322
My plan is I want to compare each number with others,
101.435//x1
101.423//x2
101.322//x3
if x1.substring(0)=x2.substring(0)=x3.substring(0)
then remove substring(0).
I want to loop this "if" condition until the substring are not same.
Please give me some idea, thanks
How come the results of your first example include decimal points while those of your second example do not?
以上就是read specific substring with condition的详细内容,更多请关注web前端其它相关文章!