Skip to content

String.Extra.prepend #53

@aminnairi

Description

@aminnairi

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions