Re: String concatenation

Posted by Gabriel Landini on
URL: http://imagej.273.s1.nabble.com/Saving-array-as-a-txt-file-tp3702004p3702008.html

On Wednesday 26 July 2006 17:19, Andy Weller wrote:
>  s = "";
>  z = 0;
>  while (z<=n) {
>     s+= ""+ax[z] + "\t";
>     z++;
>     }
> HMmm, no joy, unfortunately!

Actually this works:

ax=newArray(1,2,3,4,5,6);
n=5;
s = "";
z = 0;
while (z<=n) {
    s=s+ax[z] + "\t";
    print(s);
    z++;
   }

Output:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6

Cheers,

Gabriel