padEnd
Commons
stable
Right-pad a string to a target length by appending a repeat of the padding character. If the string is already at or beyond the target length it is returned unchanged.
API
Signature
Signature TypeScript complète, extraite du fichier util.
API
Paramètres
Paramètres d'entrée acceptés par cet util.
- strrequisstring
- The source string to pad.
- lengthrequisnumber
- The desired minimum total length of the resulting string.
- charstring'0'
- The character used for padding. Defaults to `'0'`.
API
Valeur de retour
La valeur retournée par cet util.
- The padded string. The original string is never mutated.
Usage
Exemples
Extraits de code prêts à coller.
Right-pad with zeros and custom chars