As David has already commented , the Format function does not offer a format specifier for this purpose.
If you really need a one line solution, then I suppose you could use something like:
uses Math; const Signs: array[TValueSign] of String = ('', '', '+'); var I: Integer; begin I := 100; Label1.Caption := Format('%s%d', [Signs[Sign(I)], I]);
But I would prefer to make a separate (library) procedure:
function FormatInt(Value: Integer): String; begin if Value > 0 then Result := '+' + IntToStr(Value) else Result := IntToStr(Value); end;
source share