Phrase reversals: Difference between revisions

m
m (→‎version 2: changed a comment.)
Line 701:
</lang>
=={{header|Elena}}==
ELENA 3.4.x :
<lang elena>import extensions.;
import extensions'text.;
import system'routines.;
public program()
{
[
var reverse := (:s)(s toArray;=> s.toArray().sequenceReverse; ().summarize(StringWriter new StringWriter()).);
var phrase := "rosetta code phrase reversal".;
console .printLine(phrase).;
//Reverse the string
console .printLine(reverse(phrase)).;
//Reverse each individual word in the string, maintaining original string order.
console .printLine(phrase .splitBy:" "; .selectBy(:s)(s => reverse(s) .add(" ")); .summarize(String new StringWriter()).);
//Reverse the order of each word of the phrase, maintaining the order of characters in each word.
console .printLine(reverse(phrase .splitBy:" "; .selectBy(:s)(s => s + " "))).
]}</lang>
{{out}}
<pre>
Anonymous user