I'm reading in from a text file. every time the frame number changes I need to check if the ipv6 address is changed. every time I compare the strings it tells me they don't match even after setting the value to the source address.
Asked
Active
Viewed 41 times
-4
-
can you post your codes please. – nafas Mar 04 '16 at 16:14
-
How are you comparing? Share the code, inputs and error. – Sheetal Mohan Sharma Mar 04 '16 at 16:14
-
Most likely you are using `==` instead of `.equals` – Peter Lawrey Mar 04 '16 at 16:14
-
Please [edit] your question and post code related to your problem. Without it we can't give you proper answer, but only guesses. – Pshemo Mar 04 '16 at 16:16
-
Let us know if you get it working! – Ed Cooper Mar 04 '16 at 16:41
1 Answers
1
Maybe you're using == instead of .equals()?
e.g.
ipv6_src_hold.trim() != ipv6_src_host.trim() && ipv6_dst_hold.trim() !=ipv6_src_host.trim()){
->
(! ipv6_src_hold.trim().equals(ipv6_src_host.trim() &&!ipv6_dst_hold.trim().equals(ipv6_src_host.trim())){

Ed Cooper
- 79
- 7
-
4
-
here is my code that is doing the matching sorry having a tuff time with this editor/ webpage if( ipv6_src_hold.trim() != ipv6_src_host.trim() && ipv6_dst_hold.trim() != ipv6_src_host.trim()){ System.out.println("src " + frame_Num + "\n" + ipv6_src_hold + "\n" + ipv6_src_host ); ipv6_src_hold = ipv6_src_host.trim(); System.out.println("dst " + frame_Num + "\n" + ipv6_dst_hold + "\n" + ipv6_dst_host); ipv6_dst_hold = ipv6_dst_host.trim(); frame_Num = Integer.parseInt(frame_number); } – fred g. Mar 04 '16 at 16:16
-
Maybe change the blabla != to ! blabla.equals(bla) e.g. .._dst_hold.trim() != ipv6_... to (! ..dst_hold.trim().equals(ipv6...) – Ed Cooper Mar 04 '16 at 16:17
-
And Peter firstly thanks for the input, second I wasn't able to use comments til it got upvoted . Third I might've hit the issue :) but i did write these more comment-like then answer-like, will try to improve – Ed Cooper Mar 04 '16 at 16:20
-
2@fredg. Please do not post code as a comment, it's totally unreadable. Edit your original post and format it. – tnw Mar 04 '16 at 16:21
-
Edited my answer instead of adding the specific example as another comment – Ed Cooper Mar 04 '16 at 16:24