So I have a bit of code that is supposed to pad strings of with zeros if they have a length of less than six in order to get them up to six. To accomplish this I've used the String.leftPad(Integer, String) method.
String key = '1234'; key = key.leftPad(6 - key.length(), '0'); This is supposed to output the string 001234 however it's no longer working. This is code that has been in production for nearly six months. Looking at the documentation this method is not shown, though it compiles just fine and I would swear that it worked when I initially developed it.
Is this a bug? Was functionality removed? Did I somehow tap into something that I shouldn't have?
key = key.leftPad(6-key.length()).replace(' ', '0');Can't imagine having done that if there was aleftpad(Integer, String)in the docs.