Copy srcString into dstString, padding to dstLength if needed.
Declared in <bdlb_string.h>
static
void
toFixedLength(
char* dstString,
int dstLength,
char const* srcString,
int srcLength,
char padChar = ' ');
Copy into the specified dstString at most the specified leading dstLength characters from the specified srcString having the specified srcLength. If srcLength < dstLength, after srcString is copied to dstString repeatedly append to dstString the optionally specified padChar until the total number of characters written to dstString is dstLength. If padChar is not specified the space ( ) character is appended. The behavior is undefined unless 0 <= dstLength and 0 <= srcLength.
| Name | Description |
|---|---|
| dstString | destination buffer |
| dstLength | number of characters to write to dstString |
| srcString | source string |
| srcLength | length of srcString |
| padChar | padding character when srcLength < dstLength |