aspose file tools
The moose likes Beginning Java and the fly likes Boolean Method Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Boolean Method Problem" Watch "Boolean Method Problem" New topic
Author

Boolean Method Problem

Olivier Legat
Ranch Hand

Joined: Nov 17, 2007
Posts: 176

Hello everyone,

I got this method which is meant to check if a name exists or not in a Random Access File. Basically, before I add an extra, I need to run this method to make sure that that line doesn't already exist somewhere else in the file. But no matter what happens it ALWAYS returns false

Here's the code:


Any ideas why this is happening?


Olly
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 9946
    
    6

if the file is not too big, try putting in some print statements to see what the strings are it's comparing at each step. I usually do something like

system.out.println("|" + myString + "|");

the pipes let me know EXACTLY where the string starts/ends in case there is whitespace on the beginning or end i may not see otherwise.


Never ascribe to malice that which can be adequately explained by stupidity.
Olivier Legat
Ranch Hand

Joined: Nov 17, 2007
Posts: 176

Wow! That's really helped Fred Rosenberger. I found the problem. Thanks loads


 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Boolean Method Problem
 
Similar Threads
To fetch files from a dir
How to Copy All files with certain extensions from a directory and all its subs
equals & hashcode doubt
IO
problem in checking the dimensions of an image.