Reverse words in a string: Difference between revisions

no edit summary
No edit summary
Line 3,814:
}</lang>
 
{{out}}
<pre>
------------ 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|XBS}}==
<lang XBS>set x:string = "Hello, world!";
func revWords(x:string=""){
if (x==""){send x+"<br>"});
set sp:array=x::split(" ");
send sp::reverse()::join(" ");
}
 
set lines:array=[
"---------- 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 -----------------------",
];
 
foreach(v of lines){
log(revWords(v));
}</lang>
{{out}}
<pre>
Anonymous user