Mega Code Archive

 
Categories / Delphi / Algorithm Math
 

Display a long integer in a beautiful way

Title: Display a long integer in a 'beautiful' way Question: Answer: FUNCTION FormatInt(i: INTEGER): STRING; CONST SeparationChar = '.'; VAR j : INTEGER; BEGIN Result := IntToStr(i); j := 3; WHILE Length(Result) j DO BEGIN Insert(SeparationChar, Result, Length(Result) - j + 1); Inc(j,4); END; END;