Click or drag to resize

StrZero Function (Usual, Int32)

Convert a numeric expression to a string and pad it with leading zeroes instead of blanks.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.4a
Syntax
 FUNCTION StrZero(
	nNumber AS USUAL,
	nLength AS LONG
) AS STRING
View Source

Parameters

nNumber
Type: Usual
The numeric expression to convert to a string.
nLength
Type: Int32
The length of the string to return, including zeroes, decimal digits, decimal point, and sign.

Return Value

Type: String
A string.
Remarks
StrZero() is useful in displaying numbers, creating codes such as part numbers from numeric values, and creating order keys that combine numeric and character data.  StrZero() is similar to the Str() function except that the padding character is a zero ("0") instead of a blank.
For more information, see the Str() function.
Examples
This example uses StrZero() to convert a 3-digit number to a 5-character string:
X#
1? StrZero(987, 5, 0)        // "00987"
See Also