I wonder how to remove commas from a given string. My attempt was
st = "1,2,3" String.strip(st, ?,) #=> "1,2,3"
What am I doing wrong?
String.strip/2 removes only the characters at the beginning and end of a line. I believe you are looking for String.replace/4 . Use it like this:
String.strip/2
String.replace/4
String.replace("1,2,3", ",", "")
You can also do something like this:
st |> String.split(",") |> Enum.join
Of course, it is best to use a standard tool, but then this is an alternative.