Truncate a string.
len is larger than the current size, the string is reallocated. If
len is less than the existing length (not size), the length of the string is reduced to
NUL marker is placed at
Definition at line 27 of file truncate.c.
References len, s, and str_realloc.
Referenced by str_lcut(), str_rcut(), and str_sort().
if (!str_realloc(s, len)) return 0;
if (len < s->len)
s->len = len;
s->s[len] = 0;