[#BloombergLP-bdlb-String-pad-02]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlb.adoc[bdlb]::xref:BloombergLP/bdlb/String.adoc[String]::pad
:relfileprefix: ../../../
:mrdocs:

Pad `string` on the right with `padChar` up to `length`&period;

== Synopsis

Declared in `&lt;bdlb&lowbar;string&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
void
pad(
    xref:bsl/string.adoc[bsl::string]* string,
    int length,
    char padChar = &apos; &apos;);
----

== Description

Append repeatedly to the specified `string` the optionally specified `padChar` until `string` has the specified `length`&period; If `padChar` is not specified the space (` `) character is appended&period; This operation has no effect if `string&period;size() &gt;&equals; length`&period; The behavior is undefined unless `0 &lt;&equals; length`&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *string*
| string to pad
| *length*
| desired length after padding
| *padChar*
| character used for padding (default space)
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
