UnicodeString

From Free Pascal wiki
(Redirected from Unicodestring)
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 LazUtf8 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);