… when I read that in “abcdefg”, f is the character at index -1, the last character .
page 521, first bullet. The problem is that the explanation starts with an inclusive range, “abcdefg”[1..3], then switches to excluding ranges. I suggest to use inclusive ranges :
-
so “abcdefg”[3..-2] returns “def”, since d is the character at index 3, and f is the character at index -2
-
Halfway ranges also work, so “abcdefg”[..-2] (or “abcdefg”[...-1]) returns all but the last character
-
and “abcdefg”[3..] returns everything from index 3 on (“abcdefg”[3...] including the last character could be seen as an anomaly)