Phrase reversals: Difference between revisions

→‎{{header|AppleScript}}: Added alternative code.
(Added Rust)
(→‎{{header|AppleScript}}: Added alternative code.)
Line 316:
attesor edoc esarhp lasrever
reversal phrase code rosetta"</pre>
 
---
 
Alternatively:
 
<lang applescript>set aString to "rosetta code phase reversal"
 
set astid to AppleScript's text item delimiters
set AppleScript's text item delimiters to ""
set phase1 to (reverse of characters of aString) as text
set AppleScript's text item delimiters to space
set phase2 to (reverse of words of phase1) as text
set phase3 to (reverse of words of aString) as text
set AppleScript's text item delimiters to linefeed
set output to {phase1, phase2, phase3} as text
set AppleScript's text item delimiters to astid
 
return output</lang>
{{out}}
<pre>"lasrever esahp edoc attesor
attesor edoc esahp lasrever
reversal phase code rosetta"</pre>
 
=={{header|AWK}}==
557

edits