Elm Exactly
Results / elm-core /

StringTrimTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
`String.trim`, `String.trimLeft` and `String.trimRight` remove whitespace
from both ends, the start only and the end only of `"  hello  "`.

Results

elm-0.19.1

passran in 78 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
trim1: "hello"
trimLeft1: "hello  "
trimRight1: "  hello"

elm-0.19.2

passran in 43 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
trim1: "hello"
trimLeft1: "hello  "
trimRight1: "  hello"

elm-0.19.3

passran in 80 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
trim1: "hello"
trimLeft1: "hello  "
trimRight1: "  hello"

lamdera-1.5.0

passran in 41 ms
Output
trim1: "hello"
trimLeft1: "hello  "
trimRight1: "  hello"

Discussions

Discuss this test·Search the discussions on GitHub

Discussions are on GitHub; one about this test has [t:elm-core/StringTrimTest] in its title.

Source

The -- CHECK: lines give the expected output.

module StringTrimTest exposing (main)
{-| `String.trim`, `String.trimLeft` and `String.trimRight` remove whitespace
from both ends, the start only and the end only of `" hello "`.
-}
-- CHECK: trim1: "hello"
-- CHECK: trimLeft1: "hello "
-- CHECK: trimRight1: " hello"
import Html exposing (text)
main =
let
_ = Debug.log "trim1" (String.trim " hello ")
_ = Debug.log "trimLeft1" (String.trimLeft " hello ")
_ = Debug.log "trimRight1" (String.trimRight " hello ")
in
text "done"