s.fix([length] [flags])
s - str variable.
length - new length.
1 | Don't free extra memory. Without this flag, if length < nc, may freee extra memory. |
2 | Limit s length. It changes s length only if length is less than current s length. |
4 | QM 2.3.3. Correct length so that string would not end with an invalid byte. If length is in middle of newline characters, remove whole newline. If in middle of a multibyte UTF-8 character, remove whole character. |
Sets s length.
This function can be used to:
length is number of bytes, not characters. In Unicode mode, non-ASCII characters have more than 1 byte. To limit length to a number of characters, use LimitLen instead.
int hwnd = win() str s s.all(256) int i = GetWindowText(hwnd s 256) s.fix(i) or: str s.fix(GetWindowText(win() s.all(256) 256))