You could use

a = Any[]
while ...
  push!(a, somestring)
end
join(a)



Am 17.02.2015 um 15:28 schrieb Maurice Diamantini 
<[email protected]>:

> Hi,
> 
> In Ruby, String is mutable and there is the << operator to accumulate
> a string at the end of another one.
> 
> I Julia, String is immutable and so, I use the contatenation operator
> when I need to build a large string:
> 
>     txt = ""
>     while ...
>         txt *= "yet another line.\n"
>     end
>     # do something with txt
> 
> This is very slow because it build a new (more and more large) string at each
> iteration.
> Is there another way in Julia to efficiently build such a string?
> Or is there another type one can use for that task (Buffer, Array, ....)?
> 
> Thanks in advance,
> -- Maurice

Reply via email to