Scalabium Software |
|
Knowledge for your independence'. | |
Home Delphi and C++Builder tips |
#132: I want to add leading zeros for numbers |
|
Sometimes you need add the leading zeros to numbers for formatted printing of report forms or data exporting. For this task I wrote a small function which return a formatted string (see below the AddLeadingZeros function). But today I found that standard Format function allow to do a
same! Don't ask me why in Delphi help you'll not find the description of this formatted string or why I didn't find it before:-( Below is my old function: function AddLeadingZeros(const Source: string; Len: Integer): string; var i: Integer; begin Result := Source; for i := 1 to (Len-Length(Source)) do Result := '0' + Result; end;
|
|
Copyright© 1998-2024, Scalabium
Software. All rights reserved. |