[fpc-devel] Default IntToStr operator for '+' symbol.

Skybuck Flying skybuck2000 at hotmail.com
Thu Apr 28 23:35:51 CEST 2011


Hello,

I am not sure, maybe we discussed this before, maybe not.

I am getting quite sick of having to write IntToStr all the fricking time 
like so:

begin
    s := IntToStr(X) + ' ' + IntToStr(Y);
end;

So much typing for nothing ?!?

I could have written just:
begin
    s := X + ' ' + Y;
end;

Since there is a string inside this statement Delphi could be smart enough 
to understand that X and Y have to be converted to strings.

Since X en Y are for example integers, it's logical to call TryStrToInt for 
X and Y and if the conversion fails replace it with N.A. (for not 
available).

This way these integer to string conversions can be automatic.

The same could be done for floating points. Perhaps there is an issue with 
the precision of it... perhaps this could be some kind of default.

At least the automatic integer to string conversion is a good start.

Bye,
  Skybuck. 




More information about the fpc-devel mailing list