Working with Text
7 min · Elixir
Join strings, measure them, and embed values with interpolation.
Enemy 1 of 5
Strings are binaries
Elixir strings are UTF-8 encoded binaries under the hood — you don't need to think about that detail day-to-day, but it explains why string operations in Elixir are consistently fast and why Elixir handles international text correctly by default. Day-to-day, a string is just text wrapped in double quotes, same as most languages.
Two strings are joined end-to-end with `<>`, the concatenation operator — deliberately distinct from `+`, which is reserved for numbers. This is a small but useful design choice: in Elixir, `+` and `<>` can never be confused with each other, unlike languages that overload `+` to mean both "add" and "concatenate" depending on the types involved.
Loading editor...