Search
 
SCRIPT & CODE EXAMPLE
 

ELIXIR

elixir list map key string to atom

iex> string_key_map = %{"foo" => "bar", "hello" => "world"}
%{"foo" => "bar", "hello" => "world"}

iex> for {key, val} <- string_key_map, into: %{}, do: {String.to_atom(key), val}
# or
iex> string_key_map |> Map.new(fn {k, v} -> {String.to_atom(k), v} end)
%{foo: "bar", hello: "world"}
Comment

PREVIOUS NEXT
Code Example
Elixir :: elixir timex format 
Elixir :: ** (Ecto.ConstraintError) constraint error when attempting to insert struct: * id_fkey (foreign_key_constraint) 
Elixir :: elixir get_in access all 
Elixir :: elixir check memory usage 
Elixir :: create new project phoenix 
Elixir :: extract changeset error elixir 
Scala :: scala hello world 
Scala :: scala read lines from file 
Scala :: scala option 
Scala :: how to get absolute value in scala 
Scala :: scala reverse string 
Actionscript :: mass transit logging to seq 
Excel :: excel formula update insert row column 
Excel :: excel or formula 
Perl :: perl until loop 
Perl :: perl leading zeros formatting sprintf 
Pascal :: pascal try except 
Pascal :: pascal cheat sheett 
Gdscript :: godot get global position 3 
Clojure :: algorithm to reverse a string clojure 
Assembly :: restart kde 
Assembly :: multiply two numbers assembly lmc 
Assembly :: dd utility seek 
Javascript :: jquery vslidation remove spaces from input 
Javascript :: remove non letters from a string javascript 
Javascript :: window.reload 
Javascript :: javascript split and trim 
Javascript :: update node.js dependencies 
Javascript :: javascript to detect browser 
Javascript :: how to get element by title js 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =