RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
WideString::SetLength Method

Changes the length of theSystem::WideString::WideString.

Pascal
procedure SetLength(newLength: Integer);
C++
__fastcall void SetLength(int newLength);

System::WideString::SetLength changes theSystem::WideString::WideString’s length to newLength, truncating if necessary. 

System::WideString::SetLength reallocates the underlying array of characters that stores the value of theSystem::WideString::WideString. 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 theSystem::WideString::WideString, an EOutOfMemory exception is thrown. Following a call to System::WideString::SetLength, theSystem::WideString::WideString is guaranteed to reference a unique string — that is a string with a reference count of one. 

 

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