Exampple.Template.Interpolation (exampple v0.10.5)
Interpolation let us interchange a variable inside of a string. The problem with the Elixir interpolation is it's made in compilation time which isn't useful when we need to perform the same action in runtime.
This module helps perform interpolations. It's based on Gettext.Interpolation.Default
.
Link to this section Summary
Functions
Interpolate a string adding the binding variables into the correct places.
Link to this section Functions
Link to this function
interpolate(string, bindings)
Interpolate a string adding the binding variables into the correct places.
Examples:
iex> Exampple.Template.Interpolation.interpolate("hello world!", [])
"hello world!"
iex> Exampple.Template.Interpolation.interpolate("hello %{name}!", name: "world")
"hello world!"
iex> Exampple.Template.Interpolation.interpolate("hello %{none}!", [])
"hello !"