Elixir convert string to list and return.

My database column is {:array, :string}, I am getting values like value = “1,2,3,4” as string.
I want to convert string value to an array list to store in PostgresSQL db.

1 Like

What have you tried?

1 Like

Have you tried using String.split/3 before adding the value? You could do something like:

String.split("1,2,3,4", ",")
# return ["1", "2", "3","4"]

Check out more on this and other string methods here.