elm-community / string-extra

String helper functions for Elm.

Home Page:http://package.elm-lang.org/packages/elm-community/string-extra/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple Replace function

Chadtech opened this issue · comments

Hi,

I use this function a lot.

replace : String -> String -> String -> String
replace target replacement str =
    str
        |> String.split target
        |> String.join replacement

Ive used it to replace spaces with underscores, and to replace %2F with / when decoding urls inside json.

Would this be a good addition to String.Extra?

It already exists in the core String module, see #33

Oops. Okay then. No need.