Help! How do I get out of a while loop when it stays cycled in another while loop?

0

I have a cycle while to read a file .csv and another cycle while to read a array of letters.

Inside I should print a letter and a line of .csv.

But it remains cycled and only prints each letter of the alphabet but with the same line of .csv

while ((line = rd.readLine()) != null) {

            line = rd.readLine();

            while(e < alfabeto.length)
            {
             alfabeto[e]=(char)('A'+e);
             System.out.print(alfabeto[e]+";");
             System.out.println(line);
             e++; 
             i++;
                }

     }

And this is the result

    A;1;35654423;30-12-2010:11.02;register request;Pete;50
 B;1;35654423;30-12-2010:11.02;register request;Pete;50
 C;1;35654423;30-12-2010:11.02;register request;Pete;50
 D;1;35654423;30-12-2010:11.02;register request;Pete;50
 E;1;35654423;30-12-2010:11.02;register request;Pete;50
 F;1;35654423;30-12-2010:11.02;register request;Pete;50
.
more...
.
 X;1;35654423;30-12-2010:11.02;register request;Pete;50
 Y;1;35654423;30-12-2010:11.02;register request;Pete;50
 Z;1;35654423;30-12-2010:11.02;register request;Pete;50
 BUILD SUCCESSFUL (total time: 0 seconds)

.csv file

Case ID;Event ID;dd-MM-yyyy:HH.mm;Activity;Resource;Costs
1;35654423;30-12-2010:11.02;register request;Pete;50
1;35654424;31-12-2010:10.06;examine thoroughly;Sue;400
1;35654425;05-01-2011:15.12;check ticket;Mike;100
1;35654426;06-01-2011:11.18;decide;Sara;200
1;35654427;07-01-2011:14.24;reject request;Pete;200
2;35654483;30-12-2010:11.32;register request;Mike;50
2;35654485;30-12-2010:12.12;check ticket;Mike;100
2;35654487;30-12-2010:14.16;examine casually;Sean;400
2;35654488;05-01-2011:11.22;decide;Sara;200
2;35654489;08-01-2011:12.05;pay compensation;Ellen;200
3;35654521;30-12-2010:14.32;register request;Pete;50
3;35654522;30-12-2010:15.06;examine casually;Mike;400
3;35654524;30-12-2010:16.34;check ticket;Ellen;100
3;35654525;06-01-2011:09.18;decide;Sara;200
3;35654526;06-01-2011:12.18;reinitiate request;Sara;200
3;35654527;06-01-2011:13.06;examine thoroughly;Sean;400
3;35654530;08-01-2011:11.43;check ticket;Pete;100
3;35654531;09-01-2011:09.55;decide;Sara;200
3;35654533;15-01-2011:10.45;pay compensation;Ellen;200
4;35654641;06-01-2011:15.02;register request;Pete;50
4;35654643;07-01-2011:12.06;check ticket;Mike;100
4;35654644;08-01-2011:14.43;examine thoroughly;Sean;400
4;35654645;09-01-2011:12.02;decide;Sara;200
4;35654647;12-01-2011:15.44;reject request;Ellen;200
5;35654711;06-01-2011:09.02;register request;Ellen;50
5;35654712;07-01-2011:10.16;examine casually;Mike;400
5;35654714;08-01-2011:11.22;check ticket;Pete;100
5;35654715;10-01-2011:13.28;decide;Sara;200
5;35654716;11-01-2011:16.18;reinitiate request;Sara;200
5;35654718;14-01-2011:14.33;check ticket;Ellen;100
5;35654719;16-01-2011:15.50;examine casually;Mike;400
5;35654720;19-01-2011:11.18;decide;Sara;200
5;35654721;20-01-2011:12.48;reinitiate request;Sara;200
5;35654722;21-01-2011:09.06;examine casually;Sue;400
5;35654724;21-01-2011:11.34;check ticket;Pete;100
5;35654725;23-01-2011:13.12;decide;Sara;200
5;35654726;24-01-2011:14.56;reject request;Mike;200
6;35654871;06-01-2011:15.02;register request;Mike;50
6;35654873;06-01-2011:16.06;examine casually;Ellen;400
6;35654874;07-01-2011:16.22;check ticket;Mike;100
6;35654875;07-01-2011:16.52;decide;Sara;200
6;35654877;16-01-2011:11.47;pay compensation;Mike;200

How else can I do it or what other method can I use to do it?

    
asked by Rita diaz 23.02.2018 в 21:19
source

1 answer

0

the while to read csv is fine, but I recommend the following, if you want to go through an array use a "for" cycle, because you have already defined your declared array and it has a length. To read your array and not be cycling would be as follows:

while ((line = rd.readLine()) != null) {

            line = rd.readLine();

            for(int e2 = e; e2 < alfabeto.length; e2++){
               alfabeto[e]=(char)('A'+e2);
               System.out.print(alfabeto[e2]+";");
               System.out.println(line);
            }    
     }
    
answered by 26.02.2018 в 01:27