Pad string on the right with padChar up to length.

Synopsis

Declared in <bdlb_string.h>

static
void
pad(
    bsl::string* string,
    int length,
    char padChar = ' ');

Description

Append repeatedly to the specified string the optionally specified padChar until string has the specified length. If padChar is not specified the space (` ) character is appended. This operation has no effect if `string.size() >= length. The behavior is undefined unless 0 <= length.

Parameters

Name

Description

string

string to pad

length

desired length after padding

padChar

character used for padding (default space)

Created with MrDocs