Noogλe

search input

Function of the day

  • Remove leading and/or trailing whitespace from a string s.

    To remove both leading and trailing whitespace, you can also use trim

    Whitespace is defined as any of the following characters: " ", "\t" "\r" "\n"

    Inputs

    config (Attribute set)
    start
    Whether to trim leading whitespace (false by default)
    end
    Whether to trim trailing whitespace (false by default)
    s
    The string to trim

    Type

    trimWith :: { start :: Bool; end :: Bool; } -> String -> String
    

    Examples

    lib.strings.trimWith usage example

    trimWith { start = true; } "   hello, world!   "}
    => "hello, world!   "
    
    trimWith { end = true; } "   hello, world!   "}
    => "   hello, world!"