Function StrZero() Foundation

Converts a numeric value to a character string with leading zeros.

Syntax
StrZero( <nValue>, [<nLength>], [<nDecimals>] ) --> cString
Parameters
<nValue>
<nValue> is a numeric expression whose value is converted to a character string.
<nLength>
<nLength> specifies the length of the character string returned. The length includes sign character, decimal point and decimal places.
<nDecimals>
<nDecimals> determines the number of decimal places in the character string returned.
Return

The function StrZero() formats a numeric value <nValue> as a character string with leading zeros. The length of the character string returned from StrZero() is dependent on the optional arguments <nLength> and <nDecimals>, following the same rules as the function Str().

Description

The conversion function StrZero() transforms a numeric value to a character string with leading zeros. If the numeric value is negative, the minus sign precedes the value.

Examples
StrZero()
// The example demonstrates the result of StrZero() 

PROCEDURE Main 
   LOCAL n1 := -10, n2 := -2.41 

   ? StrZero(n1)                    // result: -000000010 
   ? StrZero(n2)                    // result: -000000002.41 
   ? StrZero(n1,5)                  // result: -0010 
   ? StrZero(n2,7,2)                // result: -002.41 

RETURN 
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.