All posts

Convert an Elixir List into a comma separated String


Sometimes when working with an Elixir List you may need to utilize that list in a different format, such as a comma separated string. In this event you can reach for the Enum module and its join/2 function, for example:

=> list = ["snow shoes", "biscuits", "turtles"]
=> string = Enum.join(list, ", ")
"snow shoes, biscuits, turtles"