String
pad

Pads the given string on the left and right sides if it's shorter than the given length.

Syntax

import { pad } from '@opentf/std';
 
pad(str: string, length = 0, chars = ' '): string;

Examples

pad('abc', 8) //=> '  abc   '
 
pad('abc', 8, '_-') //=> '_-abc_-_'
 
pad('abc', 3) //=> 'abc'

Try