-4

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.

fred g.
  • 1
  • 2

1 Answers1

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
    Maybe this is a comment ;) – Peter Lawrey Mar 04 '16 at 16:15
  • 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