Cldr.Substitution.parse
You're seeing just the function
parse
, go back to Cldr.Substitution module for more information.
Specs
Parses a substitution template into a list of tokens to allow efficient parameter substitution at runtime.
template
is a binary that may include parameter markers that are substituded for values at runtime.
Returns:
- A list of tokens where any substitution is marked as an integer any any binary tokens are passed through as is.
Examples
iex> Cldr.Substitution.parse "{0}, {1}"
[0, ", ", 1]
iex> Cldr.Substitution.parse "{0} This is something {1} or another {2}"
[0, " This is something ", 1, " or another ", 2]
This function is primarily intended to support compile-time generation of templates that simplify and speed up parameter substitution at runtime.