Difference between revisions of "UnicodeString"

From Free Pascal wiki
Jump to navigationJump to search
(English translation of German page)
 
m (Alextpp moved page Unicodestring to UnicodeString: proper casing of name)
 
(One intermediate revision by one other user not shown)
Line 9: Line 9:
 
A [[Data field|data field]] of the data type '''UnicodeString''' has no size restriction and consists internally of an array of the [[Unicodechar|UniCodeChar]] data type.
 
A [[Data field|data field]] of the data type '''UnicodeString''' has no size restriction and consists internally of an array of the [[Unicodechar|UniCodeChar]] data type.
  
The functions of the [[LCLProc]] unit are required for problem-free type conversion from [[Ansistring|AnsiString]] to UnicodeString and from UnicodeString to AnsiString.
+
The functions of the LazUtf8 unit are required for problem-free type conversion from [[Ansistring|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|PUnicodeChar]] data type.
 
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|PUnicodeChar]] data type.

Latest revision as of 13:23, 22 December 2023

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);