November 2017
Intermediate to advanced
264 pages
5h 45m
English
The way Rust works with strings differs a bit from strings in other languages. All strings are valid sequences of Unicode (UTF8) bytes. They can contain null bytes, but they are not null terminated as in C.
Rust distinguishes two types of string:
// from Chapter 4/code/strings.rs
let magician1 = "Merlin";
let greeting = "Hello, world!";
let magician2: &str = "Gandalf";
let magician2: ...
Read now
Unlock full access