Suggest how to convert list to string with a character

Hi, I have a list which includes some string or integer item that I need to convert it to string with a character like “/”, then I used like bottom code.["a", "b", "c"], fn x -> "#{x}/" end) |> List.to_string

But I need to know is there a way which does not use loop like for example["a", "b", "c"], fn x -> "#{x}/" end) |> List.to_string("/")


1 Like

not sure what you want, but it seems like you are looking for

iex(1)> Enum.join(["a", "b", "c"], "/")

If you are building path, not just joining the strings, then you should use Path.join/1 instead.