String.Extra.prepend
aminnairi opened this issue · comments
aminnairi commented
It can be handy to have a method that add a string to the beginning of another.
For instance, when fetching the weather for a city and construction with a degres symbol.
temperature : String
temperature =
weather.main.temp
|> String.fromFloat
|> String.Extra.prepend "°C"
Currently, the (++)
operator would not be working for the same structure since it will be used as the second argument (and so append at the end, not at the beginning of the piped string).
temperature : String
temperature =
weather.main.temp
|> String.fromFloat
|> (++) "°C" -- Leads to an error!