Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

how to search match line in file

$
0
0
     
        try{ 
        BufferedReader br = null;  
   String file =searchTXT.getText();
        try {
            int i =0;
            br = new BufferedReader(new FileReader("CustomerDATA.txt"));
            String line ;
           
            try {
                while((line = br.readLine()) != null && line.equals(file))
                {
//                         line = br.readLine(); 
                           
                                              for( int o = 1; o <=8; o++)  
            {   String firstToken = line.split(",")[0];
//                                               System.out.println (line);
                                                 line = br.readLine();  
               
                                                 CusDetail.add(line);
//        
                                               arraytxt.append(line + "\n");
             
                 size++;
            }






i want to search account in the file when user input ..the above code is working for me ...but it wont read the first line which is the matching with the line ...what is the error??

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>