mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 04:28:00 +02:00

new ShortString->(Some)String precedence: ShortString, UTF8String, AnsiString, AnsiString(CodePage) and RawByteString, UnicodeString, WideString and other string types new AnsiString->(Some)String precedence: RawByteString, UTF8String, AnsiString, AnsiString(CodePage), UnicodeString, WideString, ShortString and other string types The new logic makes UTF8String more preferrable than other AnsiString types, AnsiString more preferrable than other AnsiStrings(codepage) and also makes UnicodeString more preferrable than WideString. git-svn-id: trunk@21057 -
38 lines
659 B
ObjectPascal
38 lines
659 B
ObjectPascal
{$codepage UTf8}
|
|
Var cad1:unicodeString;
|
|
cad2:Widestring;
|
|
n:integer;
|
|
Begin
|
|
cad1:='犮犯狃狄狪独';
|
|
cad2:=cad1;
|
|
|
|
//Unicodestring, 1 character is ok
|
|
Writeln('unicodestring');
|
|
n:=pos('犮',cad1);
|
|
Writeln(n);
|
|
if n<>1 then
|
|
halt(1);
|
|
|
|
Writeln('widestring');
|
|
n:=pos('犮',cad2);
|
|
Writeln(n);
|
|
if n<>1 then
|
|
halt(1);
|
|
|
|
//Unicodestring, more charactere wrong
|
|
Writeln('unicodestring');
|
|
n:=pos('狃狄',cad1);
|
|
Writeln(n); //show position 0
|
|
if n<>3 then
|
|
halt(1);
|
|
|
|
Writeln('widestring');
|
|
n:=pos(WideString('狃狄'),cad2); //Is correct position 3
|
|
|
|
Writeln(n);
|
|
if n<>3 then
|
|
halt(1);
|
|
|
|
Writeln('ok');
|
|
End.
|