WideString

From Free Pascal wiki
Revision as of 13:21, 22 December 2023 by Alextpp (talk | contribs) (Alextpp moved page Widestring to WideString: proper casing of name)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

English (en)


Back to data types.


The data type WideString has no size limit and comprises of an array of type WideChar. The functions of the LazUTF8 unit are there to facilitate the conversion of types from AnsiString to WideString and from WideString to AnsiString.

The examples below are for Windows operating systems!

Uses
  ...,
  LazUTF8,
  ...;
  
...

{ Definition of the WideString and AnsiString data types }

Var 
  w: WideString;
  a: AnsiString; 

Begin
  { Examples of correct assignment of AnsiString to WideString }

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

  { Example of correct assignment of a WideString to an AnsiString }

  a: = UTF16ToUTF8 (w);

  ...
end;