padLeft
Pads the left side of a string to a target length.
padLeft
Signature
typescript
function padLeft(str: string, length: number, char?: string): stringParameters
str- The string to padlength- The target lengthchar- The character to pad with (default: space)
Returns
Padded string.
Examples
typescript
import { padLeft } from 'strio'
padLeft('5', 3, '0')
// "005"
padLeft('hello', 10)
// " hello"