Built-In Namespace _global_
Method Attributes | Method Name and Description |
---|---|
pad(length, input, padding, right)
Pads strings on the right or left with user defined characters or strings.
|
Method Detail
{String}
pad(length, input, padding, right)
Pads strings on the right or left with user defined characters or strings.
Defined in: atropa-string-pad.js.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
Defined in: atropa-string-pad.js.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
console.log( pad(1, 'wee', 'um') ); // logs wee console.log( pad(1, 'wee', 'um', true) ); // logs wee console.log( pad(6, 'wee', 'um') ); // logs umuwee console.log( pad(6, 'wee', 'um', true) ); // logs weeumu
- Parameters:
- {Number} length
- The desired length of the string.
- {String|Number} input
- The string or number to pad.
- {String} padding
- The string to use for padding, may be one or more characters.
- {Boolean} right
- set to true if you want to pad to the right. Defaults to left padding.
- Returns:
- {String} Returns a string whose
length
is equal to the given length.