View Problem

Reverse the words in a string

Given the string "This is a end, my only friend!", produce the string "friend! only my end, the is This"
ExpandDiskEdit
ruby
reversed = text.split.reverse.join(' ')
ExpandDiskEdit
csharp 3.0
var str = "This is a end, my only friend!";
str = String.Join(" ", str.Split().Reverse().ToArray());
Console.WriteLine(str);
DiskEdit
clojure
(require '[clojure.contrib.str-utils2 :as str])
(str/join " " (reverse (str/split "this is the end, my only friend!" #" ")))
DiskEdit
clojure
(apply str (interpose " " (reverse (re-seq #"[^\s]+" "This is the end, my only friend!"))))
ExpandDiskEdit
fsharp
let reversed = String.Join(" ", Array.rev("This is the end, my only friend!".Split [|' '|]))

Submit a new solution for ruby, csharp, clojure, or fsharp
There are 22 other solutions in additional languages (cpp, erlang, fantom, go ...)