1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
| ExUnit.start()
defmodule StringToIntegerList do
use ExUnit.Case, async: true
# https://hexdocs.pm/elixir/1.16.0/String.html#codepoints/1
def string_to_integer_list_using_codepoints(string) do
string
|> String.codepoints()
|> Enum.map(&String.to_integer/1)
end
test "string_to_integer_list_using_codepoints" do
assert string_to_integer_list_using_codepoints("12345678910") == [
1,
2,
3,
4,
5,
6,
7,
8,
9,
1,
0
]
end
end
|