System.UnicodeString.SetLength

From RAD Studio API Documentation
Jump to: navigation, search

C++

UnicodeString&  SetLength(int newLength);

Properties

Type Visibility Source Unit Parent
function public ustring.h System UnicodeString

Description

Changes the character length of UnicodeString.

SetLength changes the string's character length to newLength, truncating if necessary.

SetLength reallocates the underlying array of characters that stores the value of the UnicodeString instance. Existing characters in the string are preserved, but the content of newly allocated space is undefined. If there is not enough memory available to reallocate the UnicodeString instance, an EOutOfMemory exception is thrown. Following a call to SetLength, the UnicodeString instance is guaranteed not to be a shared reference.

SetLength returns the modified UnicodeString object (*this).