Reverse words in a string: Difference between revisions
Content deleted Content added
No edit summary |
m Fixed the XBS example |
||
Line 3,829: | Line 3,829: | ||
=={{header|XBS}}== |
=={{header|XBS}}== |
||
<lang XBS> |
<lang XBS>func revWords(x:string=""){ |
||
(x=="")&=>send x+"<br>"; |
|||
func revWords(x:string=""){ |
|||
set sp = x::split(" "); |
|||
set sp:array=x::split(" "); |
|||
send sp::reverse()::join(" "); |
send sp::reverse()::join(" "); |
||
} |
} |
||
set lines:array=[ |
set lines:array=[ |
||
"---------- Ice and Fire ------------", |
"---------- Ice and Fire ------------", |
||
Line 3,848: | Line 3,847: | ||
"Frost Robert -----------------------", |
"Frost Robert -----------------------", |
||
]; |
]; |
||
foreach(v of lines){ |
foreach(v of lines){ |
||
log(revWords(v)); |
log(revWords(v)); |