RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
UnicodeString::SetLength Method

Changes character length of System::UnicodeString.

Pascal
function SetLength(newLength: Integer): UnicodeString&;
C++
__fastcall UnicodeString& SetLength(int newLength);

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

System::UnicodeString::SetLength reallocates the underlying array of characters that stores the value of the System::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 System::UnicodeString instance, an EOutOfMemory exception is thrown. Following a call to System::UnicodeString::SetLength, the System::UnicodeString instance is guaranteed not to be a shared reference. 

System::UnicodeString::SetLength returns the modified System::UnicodeString object (*this) 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!