This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Attempting to search a file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Attempting to search a file" Watch "Attempting to search a file" New topic
Author

Attempting to search a file

Mike Osterhout
Ranch Hand

Joined: Jun 29, 2009
Posts: 84
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

Joined: Oct 27, 2005
Posts: 19725
    
  20

Use equals() for comparing strings, never ==.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Mike Osterhout
Ranch Hand

Joined: Jun 29, 2009
Posts: 84
Thats good to know. And it fixed the problem. Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Attempting to search a file