I would suggest that your requirements are unclear.
In your situation, I would push back on my requirements
source and make them clarify what they mean by "integer".
If you are talking about hardware supported integers (which is
what technical people assume given the phrase "converted into
integer"), then leading zeros are always retained.
Your example used 00012. So if we encode that as a 16 bit integer,
you will get this somewhere on your disk:
0000 0000 0000 1110 (base-2)
Look at all those leading zeros.
Nice, aren't they.
And you get them for
free simply by defining your target as type=integer.
(32-bit, 64-bit and larger integers are left as an exercise for the reader
![Smile :-)](./images/smilies/icon_smile.gif)
)
So in this case, you could go back to your source and
say "Yes we are retaining leading zeros."
But if they
really need to see the zero characters (e.g. char( 48 ) )
then they really need some kind of CHAR type field that happens to
hold only digits but no decimal point.
If they expect binary coded decimals or some other kind of integer
encoding, then you have a similar situation.
It pretty much depends on what you mean by "integer format".
Good luck!
hari4dsx wrote:Input field is a decimal (eg. 00012.)..
This is to be converted into integer, with the preceeding zeroes retained.
Does anyone have any solution for this...?
Thanks in advance.