|
| |
$SEQNUM (pad a number with 0's to a specified column-width)
Description
Creates a fixed-column sequence number by left-padding Number with zeroes.
Syntax
At the Command Prompt (library
IS NOT initialized)
|
C:\>NTCmdLib |
$SEQNUM Number [Columns] |
At the Command Prompt (library
IS initialized)
|
C:\>L
|
$SEQNUM Number [Columns] |
In a Script (library
IS NOT initialized)
|
CALL
NTCmdLib |
$SEQNUM Number [Columns] |
In a Script (library IS
initialized)
Parameters and Switches
| Number |
|
A numeric unquoted parameter to be padded. |
| Columns |
|
The total columns to be contained in the result. |
Errorlevels, Output Variables and Custom Mount/\Commands
|
Name |
|
Value |
|
Description/Contents |
|
_SEQNUM |
|
00001
00002
etc. |
|
Variable containing the padded output |
|
ErrorLevel |
|
Description/Contents |
|
0 |
|
Success |
|
2 |
|
Missing or invalid parameter |
Examples, Notes and Instructions
Example 1 - standard usage with default columns
|
C:\GuardPost>NTCmdLib
-Quiet $SEQNUM
5
C:\GuardPost>SET
_SEQNUM
_SEQNUM=00005 |
Example 2 - Using the contents of a defined variable and a specified number of Columns, in a script with library
already initialized.
%.Call% $SEQNUM %var%
7
returns "_SEQNUM=0000022" - if var
=22
- If the first parameter specified (Number) is non-numeric or negative, $SEQNUM will return
_SEQNUM=00000.
- Invalid or missing [Columns] defaults to 5. Max Columns=15.
- Do not enclose either parameter in quotes.
- If Number is already more columns than specified in the [Columns]
parameter, the original Number is returned. For example:
%.Call% $SEQNUM 12345 4
{returns _SEQNUM=12345}
- $SEQNUM is similar to $PAD but
is optimized for numeric parameters only whereas $PAD will accept numeric or string parameters as well as a custom
PadCharacter.
- Output is displayed to STDOUT, errors to STDERR
- To suppress console display, use the library GlobalSwitch /Quiet (or simply /q)
NTCmdLib /Q TaskID /TaskSwitches Parameters
CALL NTCmdLib /Q TaskID /TaskSwitches Parameters
%.Call% /Q TaskID /TaskSwitches Parameters
Related .Mount/\Commands, #Constants,
$Functions, :Procedures
|
Resource |
|
Short Description |
| |
|
|
|
K
E
Y |
Common Commands |
INTERNAL |
External |
/SWITCH |
Parameter |
Help text |
AddonTool |
|
Mounted Commands |
.Mount/\Command |
CmdShorthand |
#Constant |
$FUNCTION |
:Procedure |
!GuardNote |
|
Operating Systems |
NT/2K/XP/K3 |
NT Only |
NT/2K |
2K Only |
2K/XP |
XP Only |
XP/K3 |
K3 Only |
2K/XP/K3 |
|