String is Elixir’s module-based abstraction for working with binary strings, commonly represented by double-quoted syntax. Functions receive data explicitly, and transformations return new values because strings are immutable. section 2.4.8 section 4.0
Use the binary-string forms that match the required syntax:
- Interpolate expressions with #{}, escape characters conventionally, or use heredocs for formatted multiline strings. section 2.4.8
- Use ~s for sigil strings; use uppercase ~S when interpolation and escape handling should remain disabled. section 2.4.8
- Concatenate binary strings with <> and chain String functions by retaining each returned value. section 2.4.8 section 4.0
- Prefer binary strings over character lists; charlists are integer-code-point lists and are not compatible with most String operations. section 2.4.8
iex(10)> "String" <> " " <> "concatenation" "String concatenation"
Inspect binary-string concatenation with the <> operator. section 2.4.8
