UnicodeString

From Free Pascal wiki
Revision as of 06:12, 2 March 2020 by Trev (talk | contribs) (English translation of German page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

English (en)


Back to data types.

Back to Character and string types.


A data field of the data type UnicodeString has no size restriction and consists internally of an array of the UniCodeChar data type.

The functions of the LCLProc unit are required for problem-free type conversion from AnsiString to UnicodeString and from UnicodeString to AnsiString.

Unicode strings are used to display strings from the Unicode character set. Unicode strings are implemented in the same way as AnsiStrings and can be cast (converted) to the PUnicodeChar data type.

Definition of a data field of data type UnicodeString:

var 
  u : UnicodeString;
  a : AnsiString;

The examples below apply to the Windows operating system!

Examples for the valid assignment of AnsiString to WideString:

  u := UTF8ToUTF16('0123ABCabc456AöU!, .-');
  u := u + UTF8ToUTF16(IntToString(45));

Example of the valid assignment of WideString to AnsiString:

  a := UTF16ToUTF8(u);