Logo

Programming-Idioms

History of Idiom 214 > diff from v6 to v7

Edit summary for version 7 by steenslag:
New Ruby implementation by user [steenslag]

Version 6

2019-11-04, 23:26:46

Version 7

2019-11-04, 23:26:58

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.

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.

Code
s = s.ljust(m, c)