Login
|
Signup
langref.org
-
csharp
,
clojure
, and
cpp
add..
all
erlang
fantom
fsharp
go
groovy
haskell
java
ocaml
perl
php
python
ruby
scala
Home
All
Solved
Unsolved
Strings
Numbers
Regex
Lists
Maps
Structure
Files
Dates
OOP
Networking
XML
Algorithms
Misc
Parallel
View Problem
Strings
Manipulation
Remove leading and trailing whitespace from a string
Given the string
" hello "
return the string
"hello"
.
csharp
string str = " hello ";
str = str.Trim();
Console.WriteLine(str);
class SolutionXX
{
static void Main()
{
string str = " hello ";
str = str.Trim();
Console.WriteLine(str);
}
}
clojure
(use 'clojure.contrib.str-utils2)
(trim " hello ")
(use 'clojure.contrib.str-utils2)
(trim " hello ")
clojure
1.3
(clojure.string/trim " hello ")
(clojure.string/trim " hello ")
clojure
(.trim " hello ")
(.trim " hello ")
cpp
C++/CLI .NET 2.0
String^ s = " hello "; String^ trimmed = s->Trim();
using namespace System;
int main()
{
String^ s = " hello "; String^ trimmed = s->Trim();
System::Console::WriteLine("|{0}|{1}|", s, trimmed);
}
Submit a new solution for
csharp
,
clojure
, or
cpp
There are 17 other solutions in
additional
languages (
erlang
,
fantom
,
fsharp
,
go
...)