I would like to know what is the meaning of "%0"
and "d%s"
in java when formatting a string
.
String.format("%0"+ (8 - "Apple".length() )+"d%s",0 ,"Apple");
Output:
000Apple
I was searching for a way to format a string with leading zeros, and that code does the work, but I don't know why it works.
Found that line of code here:
How to format a Java string with leading zero?