Subject | Re: [firebird-support] formatting a number |
---|---|
Author | Helen Borrie |
Post date | 2005-04-27T10:45:59Z |
At 03:38 PM 27/04/2005 +1000, you wrote:
PADDED_STRING = CAST(YourInteger AS STRING(10));
WHILE (NOT (PADDED_STRING LIKE '__________%'))
DO
ID_AS_STRING = '0'||ID_AS_STRING;
/* :-)) */
./heLen
>Hi all,Try this little trick (credits to Dmitry Sibiryakov):
>
>In FB1.5 how can I format a number into a string with a fixed number of
>leading zeros inside of a stored procedure ?
>
>for example if the number is 10 then after formatting it would be a
>string with a value of 0000010
PADDED_STRING = CAST(YourInteger AS STRING(10));
WHILE (NOT (PADDED_STRING LIKE '__________%'))
DO
ID_AS_STRING = '0'||ID_AS_STRING;
/* :-)) */
./heLen