I try to convert a list of strings into a list of integers. Here's the code:
list = ["114"]
list |> Enum.map(&String.to_integer(&1))
But the last line returns 'r'
. While String.to_integer("114")
returns 114
I tried Integer.parse/1
, but it also gave me 'r'
(which its character code is 114):
list
|> Enum.map(&Integer.parse(&1))
|> Enum.map(fn {num, _} -> num end)
Why?