Right pad the input string with ” ” (1 whitespace)
Returns a new string
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(string_type), | intent(in) | :: | string | |||
| integer, | intent(in) | :: | output_length |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(kind=output_length), len=max), | private | :: | char_output |
pure function padr_string_default(string, output_length) result(res) type(string_type), intent(in) :: string integer, intent(in) :: output_length character(len=max(slen(string), output_length)) :: char_output type(string_type) :: res ! We're taking advantage of `char_output` being longer than `string` and ! initialized with whitespaces. By casting `string` to a `character` ! type and back to `string_type`, we're effectively right-padding ! `string` with spaces, so we don't need to pad explicitly. char_output = char(string) res = string_type(char_output) end function padr_string_default