HomeManualTopicsTypesSymbols

std::pad_right

extends a string to the specified width

Parameters

expr
the expression that is converted into a string
n
the length of the resulting string
pad (default: " ")
the pattern used to fill up the string

Results

None

Description

This function creates a string representation of expr which is at least n characters long. If it would be shorter than it is padded to the right with the string pattern stored in pad.

The default value for pad is a single space.

Example

$str "computer" $padded_str pad_right(str 10 '_') println! padded_str

Output

computer__

Topic

Strings

See also

std::pad_left extends a string to the specified width