System.UniqueString

From RAD Studio VCL Reference
Jump to: navigation, search

Contents

Delphi Information

From System.pas

	procedure UniqueString(var str: AnsiString); overload;
 
	procedure UniqueString(var str: WideString); overload;
 
	procedure UniqueString(var str: string); overload;


Unit: System

Type: procedure

Visibility: public

C++ Information

From System.hpp

	void __fastcall UniqueString(System::AnsiStringT<0> & str);


Unit: System

Type: function

Description

Ensures that a given string has a reference count of one.


UniqueString forces the reference count on a string to one, copying the string in memory if necessary. For normal string handling, there is no need to call UniqueString. UniqueString is used only in cases where an application modifies the contents of a string after:

  • Casting the string to a PAnsiChar or PWideChar in Delphi.
  • Using the c_str(), t_str(), or data() methods of UnicodeString or AnsiString or the c_bstr() method of WideString in C++. (It is better to use data() than c_str() because c_str() returns an empty string for a NULL UnicodeString or AnsiString.)

See Also

Code Samples


Personal tools
Translations
Newest Version