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
fsharp
let reversed = String.Join(" ", Array.rev("This is the end, my only friend!".Split [|' '|]))
ExpandDiskEdit
erlang
Reversed = string:join(lists:reverse(string:tokens("This is the end, my only friend!", " ")), " "),
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
groovy
reversed = "This is the end, my only friend!".split().reverse().join(' ')
ExpandDiskEdit
groovy
reversed = "This is the end, my only friend!".tokenize(' ').reverse().join(' ')
ExpandDiskEdit
groovy apache commons lang
def revdelim(c, s) { StringUtils.reverseDelimited(s, c) }
revwords = this.&revdelim.curry(" " as char)
reversed = revwords("This is the end, my only friend!")
ExpandDiskEdit
groovy apache commons lang
reversed = StringUtils.reverseDelimited("This is the end, my only friend!", " " as char)

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