In Tokyo Delphi for Linux, what are the equivalent types of:
- ShortString
- AnsiChar
- AnsiString
I send this block of code to show how these types work for Windows but not for Linux:
program Project1;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils;
Var
Ch1 : Char;
SStr1 : String;
AStr1 : String;
{$IFNDEF LINUX}
Ch2 : AnsiChar;
SStr2 : ShortString;
AStr2 : AnsiString;
{$ENDIF}
Ch3 : UTF8Char;
SStr3 : String;
AStr3 : UTF8String;
begin
try
{ TODO -oUser -cConsole Main : Insert code here }
Ch1:= 'A'; SStr1:='AaBbCcD'; AStr1:='1234567';
WriteLn('"',Ch1,'"-"',SStr1,'"-"',AStr1,'"');
{$IFNDEF LINUX}
Ch2:= 'A'; SStr2:='AaBbCcD'; AStr2:='1234567';
WriteLn('"',Ch2,'"-"',SStr2,'"-"',AStr2,'"');
{$ELSE}
WriteLn('En Delphi Linux no se cuenta con los tipos Ansichar, ShortString y AnsiString');
WriteLn('Cuáles son los tipos equivalentes?');
{$ENDIF}
Ch3:= 'A'; SStr3:='AaBbCcD'; AStr3:='1234567';
WriteLn('"',Ch3,'"-"',SStr3,'"-"',AStr3,'"');
ReadLn;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.
There are no types actually equivalent to
ShortString
,AnsiChar
orAnsiString
, among others, in the compiler known as NextGen , which is the compiler used for Linux and mobile platforms .According to the Migrating Delphi Code to Mobile from Desktop document , possible replacements could be:
System.AnsiString
,System.ShortString
: Completely eliminate its use, considerarray of byte
(I addTBytes
)System.AnsiChar
:System.Char
,System.Byte
,System.UInt8
When talking about surrogates here, we are talking about types of data that could hold the same information, but that will have some variation in the way it is processed, or stored.