#TIL #elixirlang string으로 atom 만들기

iex> pool_config = %{name: "Auth"}
iex> String.to_atom("#{pool_config[:name]}Supervisor")
:AuthSupervisor

문자열 채우기(string interpolation)String.to_atom/1 함수를 사용하면 된다.

iex> pool_config = %{name: "Auth”}
iex> :"#{pool_config[:name]}Supervisor”
:AuthSupervisor

String.to_atom/1 함수까지 쓸 필요 있나? : 문자를 앞에 붙이면 된다.

Feedback plz <3 @ohyecloudy, ohyecloudy@gmail.com

A Random Post