This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.

Exts.String

Extensions to the core String library.

removePrefix : String -> String -> String

Strip a leading string from a String.

module Exts.String exposing (removePrefix)

{-| Extensions to the core `String` library.

@docs removePrefix

-}

import String exposing (dropLeft, length, startsWith)


{-| Strip a leading string from a `String`.
-}
removePrefix : String -> String -> String
removePrefix prefix s =
    if startsWith prefix s then
        dropLeft (length prefix) s

    else
        s