Difference between revisions of "WideString"

From Lazarus wiki
Jump to navigationJump to search
(Created WideString English page)
 
m (Fixed syntax highlighting; deleted category included in page template)
Line 1: Line 1:
{{LanguageBar}}
+
{{Widestring}}
 +
 
 +
 
 +
Back to [[Data type|data types]].
 +
 
  
 
The [[Data_type|data type]] [[Widestring|WideString]] has no size limit and comprises of an array of type [[WideChar]]. The functions of the LCLProc unit are there to facilitate the conversion of types from [[Ansistring|AnsiString]] to [[Widestring|WideString]] and from [[Widestring|WideString]] to [[Ansistring|AnsiString]].
 
The [[Data_type|data type]] [[Widestring|WideString]] has no size limit and comprises of an array of type [[WideChar]]. The functions of the LCLProc unit are there to facilitate the conversion of types from [[Ansistring|AnsiString]] to [[Widestring|WideString]] and from [[Widestring|WideString]] to [[Ansistring|AnsiString]].
Line 32: Line 36:
 
end;
 
end;
 
</syntaxhighlight>
 
</syntaxhighlight>
 
[[Category:Data_types]]
 

Revision as of 11:37, 4 March 2020

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 LCLProc 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
  ...,
  LCLProc,
  ...;
  
...

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