Programming-Idioms

History of Idiom 214 > diff from v5 to v6

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

Version 5

2019-11-04, 19:04:16

Version 6

2019-11-04, 23:26:46

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)