
substring exceeds the number of characters in the object string. substr(17, 23) asks
for a substring of length 23 beginning at position 17. There are only 38 characters in
the string TITLE, so this request cannot be fulfilled. In this case, the rest of the object
string is returned beginning at position 17. The seventh line of output prints the length
of the string returned (21). What happens if the beginning position is outside the
string? The program crashes.
The eighth line of output is the result of applying the at function to TITLE
(TITLE.at(4)), which returns the character in the fourth position of the string.
We said that there are five useful ...