System.Rtti.TValue.ToString

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function ToString(const AFormatSettings: TFormatSettings): string; overload;
function ToString: string; overload;

C++

System::UnicodeString __fastcall ToString(const System::Sysutils::TFormatSettings &AFormatSettings)/* overload */;
System::UnicodeString __fastcall ToString()/* overload */;

Properties

Type Visibility Source Unit Parent
function public
System.Rtti.pas
System.Rtti.hpp
System.Rtti TValue

Description

Returns the string representation of the value stored in the TValue record.

Call ToString to obtain a string that represents the value stored in the TValue record. Each stored types of values have different string representations. For example, the string representation of a stored integer is actually the same as the one obtained by a call to IntToStr method.

When you call the .ToString() member, an empty TValue record returns the string '(empty)' and not '', see examples in the following table.

Description Code Result of .ToString()
Empty Value
#include <System.RTTI.hpp>
#include <Vcl.Dialogs.hpp>
int main() {
  TValue v;
  ShowMessage(v.ToString());
}
'(empty)'
TValue with empty string
#include <System.RTTI.hpp>
#include <Vcl.Dialogs.hpp>
int main() {
  String s;
  TValue v;
  v = s;
  ShowMessage(v.ToString());
}
''

See Also

Code Examples