Login
|
Signup
langref.org
-
ruby
,
clojure
, and
erlang
add..
all
cpp
csharp
fantom
fsharp
go
groovy
haskell
java
ocaml
perl
php
python
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"
.
ruby
puts " hello ".strip
puts " hello ".strip
ruby
" hello ".strip!
" hello ".strip!
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 ")
erlang
Trimmed = string:strip(S),
-module(trim).
-export([start/0]).
start() ->
S = " hello ",
Trimmed = string:strip(S),
io:format("|~s|~s|~n", [S, Trimmed]).
Submit a new solution for
ruby
,
clojure
, or
erlang
There are 16 other solutions in
additional
languages (
cpp
,
csharp
,
fantom
,
fsharp
...)