Triple single quote strings in Groovy - Should the resulting string contain extra spaces?
grails, groovy
Solution
Since Groovy 1.7.3:
def description = '''\
Join the Perl programmers of the Pork Producers
of America as we hone our skills and ham it up
a bit. You can show off your programming chops
while trying to win a year's supply of pork
chops in our programming challenge.
Come and join us in historic (and aromatic),
Austin, Minnesota. You'll know when you're
there!'''.stripIndent()
Problem
If I use the following groovy code: ``` description: '''Join the Perl programmers of the Pork Producers of America as we hone our skills and ham it up a bit. You can show off your programming chops while trying to win a year's supply of pork chops in our programming challenge. Come and join us in historic (and aromatic), Austin, Minnesota. You'll know when you're there!''' ``` Isn't groovy supposed to create one long string with only single spaces between lines (meaning that the spaces between lines will not be kept)? The resulting string would be: Join the Perl programmers of the Pork Producers of America as we hone our skills and ham it up a bit... etc The string I got contained all the spaces between lines. Is this the expected behavior?