Phrase reversals: Difference between revisions

Content added Content deleted
(Applesoft BASIC)
imported>Arakov
Line 901: Line 901:


=={{header|Elena}}==
=={{header|Elena}}==
ELENA 4.x :
ELENA 6.x :
<syntaxhighlight lang="elena">import extensions;
<syntaxhighlight lang="elena">import extensions;
import extensions'text;
import extensions'text;
Line 916: Line 916:
console.printLine(reverse(phrase));
console.printLine(reverse(phrase));
//Reverse each individual word in the string, maintaining original string order.
//Reverse each individual word in the string, maintaining original string order.
console.printLine(phrase.splitBy:" ".selectBy:(s => reverse(s).add(" ")).summarize(new StringWriter()));
console.printLine(phrase.splitBy(" ").selectBy::(s => reverse(s).add(" ")).summarize(new StringWriter()));
//Reverse the order of each word of the phrase, maintaining the order of characters in each word.
//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 + " ")))
console.printLine(reverse(phrase.splitBy(" ").selectBy::(s => s + " ")))
}</syntaxhighlight>
}</syntaxhighlight>
{{out}}
{{out}}