elm-community / elm-community/string-extra

String.Extra.prepend

Open
#53 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Elm
Stars
36
Forks
27
PR merge metrics
No merged PRs in 30d

Description

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.

```elm
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).

```elm
temperature : String
temperature =
weather.main.temp
|> String.fromFloat
|> (++) "°C" -- Leads to an error!
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.