Reverse words in a string: Difference between revisions
Content deleted Content added
m →{{header|Wren}}: Changed to Wren S/H |
added RPL |
||
Line 3,502: | Line 3,502: | ||
----------------------- Robert Frost |
----------------------- Robert Frost |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
« { } |
|||
'''WHILE''' OVER " " POS '''REPEAT''' |
|||
LASTARG → sep |
|||
« OVER 1 sep SUB + |
|||
SWAP sep 1 + OVER SIZE SUB SWAP |
|||
» |
|||
'''END''' |
|||
SWAP + REVLIST |
|||
'''IFERR''' ∑LIST '''THEN''' 1 GET '''END''' |
|||
» '<span style="color:blue">REVWORDS</span>' STO |
|||
{ "---------- Ice and Fire ------------" "" "fire, in end will world the say Some" "ice. in say Some" "desire of tasted I've what From" "fire. favor who those with hold I" "" "... elided paragraph last ..." "" "Frost Robert -----------------------" } |
|||
1 « <span style="color:blue">REVWORDS</span> » DOLIST |
|||
{{out}} |
|||
<pre> |
|||
1: { "------------ Fire and Ice ----------" |
|||
"" |
|||
"Some say the world will end in fire," |
|||
"Some say in ice." |
|||
"From what I've tasted of desire" |
|||
"I hold with those who favor fire." |
|||
"" |
|||
"... last paragraph elided ..." |
|||
"" |
|||
"----------------------- Robert Frost" } |
|||
</pre> |
|||
=={{header|Ruby}}== |
=={{header|Ruby}}== |