Consider:
function x_StrZero(N: Double; W: Integer; D: Integer = 0): String;
var S : String;
begin
Str(N:W:D,S);
S := Trim(S);
This gives W1057 Implicit string cast from 'ShortString' to 'string'
The online doc says:
procedure Str(const X [: Width [:Decimals]]; var S: String);
but also
Notes: However, on using this procedure, the compiler may issue a warning: W1057 Implicit string cast from '%s' to '%s' (Delphi).
Why would this be?
I would like to prevent this ugly workaround:
function x_StrZero(N: Double; W: Integer; D: Integer = 0): String;
var
S : String;
SS : ShortString;
begin
Str(N:W:D,SS);
S := Trim(String(SS));
I have read Why does Delphi warn when assigning ShortString to string? but that does not answer this.