Set string length

Syntax

s.fix([length] [flags])

 

Parameters

s - str variable.

length - new length.

flags:

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 2.3.3. In Unicode mode, correct string length so that it would not end with an invalid character. That is, if length is in a middle of a multibyte character, removes the character.

 

Remarks

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.

 

Example

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))