Strings
Strictly speaking, there are no strings in Erlang. To represent a string in Erlang, we can choose between representing the string as a list of integers or as a binary (for a discussion of binaries, see Binaries). When a string is represented as a list of integers, each element in the list represents a Unicode codepoint.
We can create such a list by using a string
literal. A string literal is just a sequence
of characters enclosed in double quotation marks ("), so,
for example, we can write this:
| | 1> Name = "Hello". |
| | "Hello" |
"Hello" is just shorthand for the list of
integer character codes that represent the individual
characters in that string.
Note: In some programming languages, strings can be quoted with either single or double ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access