Zero Padding
Ruby makes zero-padding strings to a fixed length easy with String#rjust
.
In the same way, you can pad zeros on the other side of the string with String#ljust
.
h/t Dillon Hafer
Last updated
Was this helpful?
Ruby makes zero-padding strings to a fixed length easy with String#rjust
.
In the same way, you can pad zeros on the other side of the string with String#ljust
.
h/t Dillon Hafer
Last updated
Was this helpful?