Login
|
Signup
langref.org
-
python
,
fsharp
, and
fantom
add..
all
clojure
cpp
csharp
erlang
go
groovy
haskell
java
ocaml
perl
php
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"
.
python
assert 'hello' == ' hello '.strip()
assert 'hello' == ' hello '.strip()
fsharp
let s = " hello "
let trimmed = s.Trim()
#light
open System
let s = " hello "
let trimmed = s.Trim()
printfn "|%s|%s|" s trimmed
fsharp
let trimmed = " hello ".Trim()
#light
open System
let trimmed = " hello ".Trim()
printfn "|%s|" trimmed
fantom
s := " hello ".trim
class SolutionXX
{
Void main()
{
s := " hello ".trim
}
}
Submit a new solution for
python
,
fsharp
, or
fantom
There are 18 other solutions in
additional
languages (
clojure
,
cpp
,
csharp
,
erlang
...)