Pregunta

I am trying to concatenate two strings using groovy shell but it's not working

   groovy.shell("def name = 'MyName'; def fname = 'firstName'; println name+fname" );

But for single string this is working

   groovy.shell("def name ='MyName'; println name");

Any idea about this?

¿Fue útil?

Solución

You can Use StringBuilder as below Object value = shell.evaluate("def name= new StringBuilder('James'); def fname= new StringBuilder('abd'); println name.append(fname) ;");

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top