Data and the standard library

Text and time arrive as bytes, and a program has to say which encoding and which clock it means. This part starts with Unicode, puts a timestamp on a value, and encodes a map as JSON with the module Erlang/OTP 27 ships.

The second half is a tour of the standard library and the tools a program uses every day: the lists and maps functions that already exist, regular expressions, the week and offset of a timestamp, a random number that is safe for a token, and the term format that keeps a value in a file. No lesson here needs a package from the network.

7.1 Encodings and Unicode UTF-8 in a binary, the string module, and the codes of a character Open 7.2 Time and date monotonic time, system time, calendar, and the timestamp of a file Open 7.3 JSON and term formats the json module of OTP 27, iodata, and term_to_binary Open 7.4 The standard library tour lists, maps, string, binary, io_lib and proplists Open 7.5 Regular expressions the re module, a match, a capture, and a global replace Open 7.6 Dates and calendars calendar, erlang:system_time, and the time zone of a timestamp Open 7.7 Random numbers and hashes rand, crypto hashes, and a token that is hard to guess Open 7.8 Term formats term_to_binary, binary_to_term, file:consult, and a config file Open

Lessons