View Problem

Remove leading and trailing whitespace from a string

Given the string "  hello    " return the string "hello".
DiskEdit
ruby
puts " hello ".strip
DiskEdit
ruby
" hello ".strip!
ExpandDiskEdit
cpp C++/CLI .NET 2.0
String^ s = " hello "; String^ trimmed = s->Trim();
ExpandDiskEdit
fsharp
let s = " hello "
let trimmed = s.Trim()
ExpandDiskEdit
fsharp
let trimmed = " hello ".Trim()
ExpandDiskEdit
erlang
Trimmed = string:strip(S),
ExpandDiskEdit
csharp
string str = " hello ";
str = str.Trim();
Console.WriteLine(str);
DiskEdit
haskell
unwords (words " hello ")

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