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
csharp
string str = " hello ";
str = str.Trim();
Console.WriteLine(str);
ExpandDiskEdit
cpp C++/CLI .NET 2.0
String^ s = " hello "; String^ trimmed = s->Trim();
ExpandDiskEdit
fantom
s := " hello ".trim
ExpandDiskEdit
erlang
Trimmed = string:strip(S),

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