Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Attempting to search a file

 
Mike Osterhout
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am trying to search a text file that looks like this
Smith;John;332-5467
Jones;Mary;456-2312
Sam;Henry;345-0987
Henry;Ed;768-0934
Jones;Paula;222-8787
Smith;Karen;343-0223

Everything seems to be working except the part that needs to work.



Basically I am reading a file, and trying to compare the last name in the file to the input provided by the user. However for some reason last==delimit[0] never equal.
 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use equals() for comparing strings, never ==.
 
Mike Osterhout
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thats good to know. And it fixed the problem. Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic