groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jmeter Tea <jmeter...@gmail.com>
Subject Re: Long String concatenation failed
Date Tue, 25 Sep 2018 11:24:40 GMT
Hi Nelson, You mean to use append method as in  StringBuilder:
new StringBuilder().append( foo )
                       .append( bar )
                       .append( www )
                       .toString()

On Tue, Sep 25, 2018 at 2:19 PM, Nelson, Erick <Erick.Nelson@hdsupply.com>
wrote:

> Looks like a job for MarkupBuilder or StreamingMarkupBuilder
>
> Sent from my iPhone
>
> On Sep 25, 2018, at 3:56 AM, Jmeter Tea <jmetertea@gmail.com> wrote:
>
> Hello,
>
> I have to
> concatenate a lot of variables in a script and I want to make it readable, but I failed
to separate lines as in java, The following code doesn't compile due to:
>
> Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> Script1.groovy: 2: unexpected token: << @ line 2, column 1.
>    << vars["id2"] << "<id2>"
>
> Code:
> String text ="<id>" <<vars["id1"] << "<id><id2>" <<
vars["id2"] << "<id2>";
>
>
> Is there a workaround or a better way concatenation a string in groovy?
>
> Related question:
> https://stackoverflow.com/questions/47786399/jmeter-
> groovy-script-concatenation-of-variables
>
> Thank you
>
>

Mime
View raw message