Click or drag to resize

StrZero Function (Usual, Long, Long)

X#
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.19
Syntax
 FUNCTION StrZero(
	nNumber AS USUAL,
	nLength AS LONG,
	nDecimals AS LONG
) AS STRING
Request Example View Source

Parameters

nNumber
Type: Usual
The numeric expression to convert to a string.
nLength
Type: Long
The length of the string to return, including zeroes, decimal digits, decimal point, and sign.
nDecimals
Type: Long
The number of decimal places in the return value.

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