padId
The padId function converts a number to a string and pads it with leading zeros to reach the specified number of digits.
Syntax
Section titled “Syntax”{number | padId:digits}Parameters
Section titled “Parameters”input(number): The number to paddigits(number): The total number of digits desired
Returns
Section titled “Returns”A string with the number padded with leading zeros
Examples
Section titled “Examples”Basic padding
Section titled “Basic padding”{5 | padId:3}// Returns: "005"No padding needed
Section titled “No padding needed”{123 | padId:3}// Returns: "123"Larger padding
Section titled “Larger padding”{42 | padId:6}// Returns: "000042"In vulnerability IDs
Section titled “In vulnerability IDs”{"VULN-" | append:{vulnerability.id | padId:4}}// Returns: "VULN-0023" (if id is 23)Sequential numbering
Section titled “Sequential numbering”{index | padId:2}// Returns: "01", "02", "03", etc.Use Cases
Section titled “Use Cases”- Creating uniform ID formats
- Generating invoice or ticket numbers
- Formatting sequential identifiers
- Building sortable reference codes
- Standardizing numerical displays in reports