1module String.Ext exposing (..)
2
3{-| Flipped version of `append`.
4-}
5
6-- 🔱
7
8
9{-| Flipped version of `append`.
10-}
11addSuffix : String -> String -> String
12addSuffix a b =
13 String.append b a
14
15
16{-| Chop something from the end of a string until it's not there anymore.
17-}
18chopEnd : String -> String -> String
19chopEnd needle str =
20 if String.endsWith needle str then
21 str
22 |> String.dropRight (String.length needle)
23 |> chopEnd needle
24
25 else
26 str
27
28
29{-| Chop something from the beginning of a string until it's not there anymore.
30-}
31chopStart : String -> String -> String
32chopStart needle str =
33 if String.startsWith needle str then
34 str
35 |> String.dropLeft (String.length needle)
36 |> chopStart needle
37
38 else
39 str
40
41
42{-| Join a list of Strings with a space in between.
43-}
44joinWithSpace : List String -> String
45joinWithSpace =
46 String.join " "