limitStringLength

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.

inout(mstring)
limitStringLength
(
inout(mstring) str
,
size_t max_len
)

Parameters

str inout(mstring)

the string to be sliced

max_len size_t

the maximum allowable length (in bytes) of the string

Return Value

Type: inout(mstring)

a slice of the original string, of length at most max_len.

Meta