If your string contains numbers only, you can make it an integer and then do padding:
String.format("%010d", Integer.parseInt(mystring));
More Related Contents:
- How can I pad a String in Java?
- StringBuilder vs String concatenation in toString() in Java
- Sort on a string that may contain a number
- Remove all occurrences of char from string
- Java – Convert integer to string [duplicate]
- String concatenation in Java – when to use +, StringBuilder and concat [duplicate]
- In Java, is there a way to write a string literal without having to escape quotes?
- How to remove line breaks from a file in Java?
- How can I get the size of an array, a Collection, or a String in Java?
- Getting strange output when printing result of a string comparison
- How to remove duplicate white spaces in string using Java?
- Isn’t the size of character in Java 2 bytes?
- java.lang.IllegalStateException: Scanner closed
- Converting an int to a binary string representation in Java?
- Difference between “char” and “String” in Java
- Fatal Error: Invalid Layout of java.lang.String at value
- String replacement in java, similar to a velocity template
- How to center a string using String.format?
- Read String line by line
- How to get the last characters in a String in Java, regardless of String size
- How to create variables dynamically in Java? [closed]
- substring index range
- How to replace a substring of a string [duplicate]
- How to replace � in a string
- How do I get the last character of a string?
- Is it possible in Java to override ‘toString’ for an Objects array?
- String.replaceAll is considerably slower than doing the job yourself
- Remove all occurrences of \ from string
- Is there a difference between String concat and the + operator in Java? [duplicate]
- Java String literal pool and string object