Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Fortran

Idiom #214 Pad string on the right

Append extra character c at the end of string s to make sure its length is at least m.
The length is the number of characters, not the number of bytes.

That's automatically the way strings are handled, as specified by the Fortran language standard.
CHARACTER(N) ::  FOO
s = s.PadRight(m, c);

New implementation...