Algorithm Math Delphi

Title: How to convert values in any type to string
Question: How to convert values in any type do string value ?
Answer:
If you want learn more, see the "Variant" and "TVarData" in
help... Its easy....
function ToString(Value: Variant): String;
begin
case TVarData(Value).VType of
varSmallInt,
varInteger : Result := IntToStr(Value);
varSingle,
varDouble,
varCurrency : Result := FloatToStr(Value);
varDate : Result := FormatDateTime('dd/mm/yyyy', Value);
varBoolean : if Value then Result := 'T' else Result := 'F';
varString : Result := Value;
else Result := '';
end;
end;
Usage:
ShowMessage(ToString(10.87));
ShowMessage(ToString(10));
or
var
V1 : Double;
V2 : Integer;
V3 : TDateTime;
V4 : Boolean;
begin
...
...
...
ShowMessage(ToString(V1)); // Double to String;
ShowMessage(ToString(V2)); // Integer to String;
ShowMessage(ToString(V3)); // DateTime to String;
ShowMessage(ToString(V4)); // Boolean to String;
end;