From RAD Studio API Documentation
Jump to: navigation, search


type UnicodeString = { built-in type };


class RTL_DELPHIRETURN UnicodeString


Type Visibility Source Unit Parent
System System


UnicodeString is the C++ analog for the Delphi UnicodeString type.

Delphi utilizes several string types. UnicodeString can contain both Unicode and ANSI strings, ANSI strings being converted first. 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.

UnicodeString variables that have not been assigned an initial value contain a zero-length string.

Note: Delphi also supports UnicodeString, but implements it as a primitive type rather than a class. By default, variables declared as type String are UnicodeString.

String indexes are 1-based in desktop platforms and 0-based in mobile platforms. For more information, see Migrating Delphi Code to Mobile from Desktop.

Tip: You can go through the values of a string without specifying any index. In Delphi, use for … in. In C++, you can use range-based for loops (only with Clang-enhanced C++ compilers) and STL iterators to go through the values of a string without specifying any index.

See Also