How not to pad strings
A database that I recently worked with had a string field for an IP address. For whatever reason, somebody decided that the field needed to be padded to a certain length. This somebody also decided that the strings should be padded on the right. With '0' characters.
Oh, fun times.
okay is that:
there's no way to tell!
@accalia Clearly, the only solution here is IPv6 because those are longer and therefor don't need to be padded!
Also Filed Under: + you can probably even pad them with 0s (on the left side, though)
@accalia Yup, exactly. Apparently that issue never occurred to the somebody.
Should just have used
npm install left-pad
I remember working on enterprise software where the backend was COBOL. Therefore all strings where left padded with spaces. Then some customer complained about the fixed-width font.
We changed the font.
Now, all of the sudden, none of the fields right aligned anymore.