i have the following code snippit that won't compile:
procedure Frob(const Grob: WideString);
var
s: WideString;
begin
s :=
Grob[7]+Grob[8]+Grob[5]+Grob[6]+Grob[3]+Grob[4]+Grob[1]+Grob[2];
...
end;
Delphi5 complains Incompatible types
.
i tried simplifying it down to:
s := Grob[7];
which works, and:
s := Grob[7]+Grob[8];
which does not.
i can only assume that WideString[index]
does not return a WideChar
.
i tried forcing things to be WideChars
:
s := WideChar(Grob[7])+WideChar(Grob[8]);
But that also fails:
Incompatible types
5
: Delphi 5Grob[7]
is a WideChar
; that's not the issue.
The issue seems to be that the +
operator cannot act on wide chars. But it can act on wide strings, and any wide char can be cast to a wide string:
S := WideString(Grob[7]) + WideString(Grob[8]);