792 B
792 B
title |
---|
Strings |
Strings
Strings in Elixir are wrapped with double-quotes, while Character Lists are single-quoted. They are UTF-8 encoded binaries.
iex> "Hello world!"
"Hello world!"
String Interpolation is possible in Elixir with an octothorp followed by curly braces.
iex> variable = "world!"
"world!"
iex> "Hello #{variable}"
"Hello world!"
The String module contains many helpful built in functions based on the Unicode standard.
iex> example = "string"
"string"
iex> String.capitalize(example)
"String"
iex> String.duplicate(example, 2)
"stringstring"