home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 5
/
ctrom5b.zip
/
ctrom5b
/
PROGRAM
/
DELPHI
/
LEADZR
/
READ_ME.TXT
< prev
Wrap
Text File
|
1995-04-27
|
2KB
|
46 lines
===============================================================================
Leading Zero Component
This is my first pass at a component, so bear with me. The component
was designed to take an integer value and convert it to a string value
with leading or trailing zeros. I created for use with fixed length
text flat files where I had to calculate running totals.
Here are the published properties:
{The input value - must be of type LongInt}
property InputVal : LongInt read FInputVal write FInputVal;
{The width of the string to return}
property Width : Integer read FWidth write FWidth;
{Justification - must be 'Right' or 'Left'}
property Align : String read FAlign write FAlign;
To use it you call the public function:
function FillZeroes(rstSize, inVal : LongInt; aAlign : String ) : String;
where: rstSize = The returned string size that you want (string width)
inVal = input value
aAlign = 'Right' or 'Left' justification
For example, FillZeroes(8, 312, 'Right') would return:
'00000312'
===============================================================================
Installation
Just add the LeadZero.dcu to your library, or add the PAS file, whichever is of
use to you.
===============================================================================
Note
Since this is my first pass at a component, and this is really a simple one,
I'd really appreciate any pointers or tips on how I could improve my code.
Thanks!!!
Brendan Delumpa 72410,520