RosettaCodeData/Task/Reverse-words-in-a-string/Groovy/reverse-words-in-a-string.groovy
2015-02-20 09:02:09 -05:00

15 lines
677 B
Groovy

def text = new StringBuilder()
.append('---------- Ice and Fire ------------\n')
.append(' \n')
.append('fire, in end will world the say Some\n')
.append('ice. in say Some \n')
.append('desire of tasted I\'ve what From \n')
.append('fire. favor who those with hold I \n')
.append(' \n')
.append('... elided paragraph last ... \n')
.append(' \n')
.append('Frost Robert -----------------------\n').toString()
text.eachLine { line ->
println "$line --> ${line.split(' ').reverse().join(' ')}"
}