Functiondojo.string.pad

dojo.require("dojo.string");
defined in dojo/string.js

Pad a string to guarantee that it is at least size length by filling with the character ch at either the start or end of the string. Pads at the start, by default.

Usage

function (/*String*/ text, /*Integer*/ size, /*String?*/ ch, /*Boolean?*/ end) (view source)
parametertypedescription
textStringthe string to pad
sizeIntegerlength to provide padding
chStringOptional. character to pad, defaults to '0'
endBooleanOptional. adds padding at the end if true, otherwise pads at start