Consultor Eletrônico



Kbase P125098: How to keep the leading zeroes of an integer field when casting it into a string?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   30/07/2007
Status: Unverified

GOAL:

How to keep the leading zeroes of an integer field when casting it into a string?

GOAL:

How to keep the leading zeroes of an integer variable when casting it into a string?

FIX:

This solutions shows how to keep the leading zeroes of an integer field or variable when casting to a string.
If the format is not specified with the STRING statement the leading zeroes are suppressed.
DEF VAR i AS INT FORMAT "9999999999" INIT 12345.
DISPLAY i.
DEF VAR c AS CHAR FORMAT "x(10)".
c = STRING(i, "999999999").
DISPLAY c.