RAD Studio VCL Reference
|
System::AnsiString is the C++ analog for the Delphi long string type.
AnsiString = class;
class AnsiString;
dstring.h
Delphi utilizes several string types. The most important is the long string type, more commonly known as System::AnsiString. Support for this type includes the following features:
strings as large as available memory;
efficient use of memory through shared references;
routines and operators that evaluate strings based on the current locale.
Despite its name, System::AnsiString is not restricted to the ANSI character set, and can utilize any character set supported by the current locale definition, including multi-byte character sets.
System::AnsiString variables that have not been assigned an initial value contain a zero-length string.
To utilize the C++ streaming operators (<< and >>) with System::AnsiString, you must iostream before including system.hpp and use AnsiString::c_str() to return the internal string representation. The following example demonstrates the usage of AnsiString with stream operators:
#include <iostream> #include <system.hpp> int main() { AnsiString HelloStr = "hello"; std::cout << HelloStr.c_str(); }
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|