Limits the length of a UTF-8 string, to at most the specified number of bytes.
This is conceptually equal to str[0..max_len], except that we take care to avoid chopping a multi-byte UTF-8 character in half.
the string to be sliced
the maximum allowable length (in bytes) of the string
a slice of the original string, of length at most max_len.
See Implementation
Limits the length of a UTF-8 string, to at most the specified number of bytes.
This is conceptually equal to str[0..max_len], except that we take care to avoid chopping a multi-byte UTF-8 character in half.