History of Idiom 216 > diff from v1 to v2
Edit summary for version 2 by steenslag:
New Ruby implementation by user [steenslag]
New Ruby implementation by user [steenslag]
↷
Version 1
2019-11-03, 13:44:18
Version 2
2019-11-04, 01:10:38
Idiom #216 Pad a string in the center
Prepend extra character c at the beginning and ending of string s to make sure its length is at least m.
After the padding the original content of s should be at the center of the result.
The length is the number of characters, not the number of bytes.
E.g. the with s = "abcd", m=10 and c="X" the result should be "XXXabcdXXX".
Idiom #216 Pad a string in the center
Prepend extra character c at the beginning and ending of string s to make sure its length is at least m.
After the padding the original content of s should be at the center of the result.
The length is the number of characters, not the number of bytes.
E.g. the with s = "abcd", m=10 and c="X" the result should be "XXXabcdXXX".