PDA

View Full Version : Java string concatenation in the iteration


Besim
Oct 8, 2014, 10:54 AM
Hi everyone can any help me with this:


Make a program that asks for an integer and prints all integers from one to the entered integer. By performing a string concatenation in the iteration, let the label text value to be the value it had last lap plus the new century.

Thanks to everyone for his time.

CravenMorhead
Oct 8, 2014, 11:16 AM
This won't compile:
----
string entry;
for(I = 1 to number)
entry.append("%s %d",entry,number);
----

It is simple to take an empty string, and run it through the loop. Each time through to append/concatenate the iterative number on the end.