Sunday, August 7, 2011

Java: Left padding a number with zero

For padding any string with zeros at left side, you can easily use the String.format() of Java. Here is an example code.


int number = 10;
System.out.println(String.format("%05d",number));


Output will be00010

No comments:

Get function name programaticaly - Python

This little piece of code will help you to get the function name programatically. This is very helpful when you are implementing the debug...