UnicodeString: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: UnicodeString
| Old | New | Line | |
|---|---|---|---|
| 1 | + | Back to [[Data type|data types]]. | |
| 2 | + | ||
| 3 | + | Back to [[Character and string types]]. | |
| 4 | + | ||
| 5 | + | 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. | |
| 6 | + | ||
| 7 | + | The functions of the LazUtf8 unit are required for problem-free type conversion from [[Ansistring|AnsiString]] to UnicodeString and from UnicodeString to AnsiString. | |
| 8 | + | ||
| 9 | + | 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. | |
| 10 | + | ||
| 11 | + | Definition of a data field of data type **UnicodeString**: | |
| 12 | + | ||
| 13 | + | ``` pascal | |
| 14 | + | var | |
| 15 | + | u : UnicodeString; | |
| 16 | + | a : AnsiString; | |
| 17 | + | ``` | |
| 18 | + | ||
| 19 | + | The examples below apply to the Windows operating system! | |
| 20 | + | ||
| 21 | + | Examples for the valid assignment of [[Ansistring|AnsiString]] to [[Widestring|WideString]]: | |
| 22 | + | ||
| 23 | + | ``` pascal | |
| 24 | + | u := UTF8ToUTF16('0123ABCabc456AöU!, .-'); | |
| 25 | + | u := u + UTF8ToUTF16(IntToString(45)); | |
| 26 | + | ``` | |
| 27 | + | ||
| 28 | + | Example of the valid assignment of [[Widestring|WideString]] to [[Ansistring|AnsiString]]: | |
| 29 | + | ||
| 30 | + | ``` pascal | |
| 31 | + | a := UTF16ToUTF8(u); | |
| 32 | + | ``` | |
| 33 | + | ||
| 34 | + | --- | |
| 35 | + | *From the Free Pascal wiki, page "UnicodeString", as it stood on 2023-12-22 after a change by Alextpp, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
