List of utility methods to do String Pad Zero
String | zeroPad(String string, int digits) zero Pad while (string.length() < digits) string = "0" + string; return string; |
String | zeroPadAfterTo(String hex, int i) zero Pad After To if (hex.length() == i) { return hex; } else if (hex.length() > i) { throw new AssertionError(); StringBuilder sb = new StringBuilder(); for (int j = 0; j < i - hex.length(); j++) { sb.append('0'); ... |
String | zeroPadding(String str, int len) Converts the string to "zero-padded" string StringBuffer buffer = new StringBuffer(str); for (int i = 0; i < len - str.length(); i++) { buffer.insert(0, '0'); return buffer.toString(); |
String | zeroPadding(String value, int n) zero Padding if (value.length() > n) return value; StringBuilder sb = new StringBuilder(); for (int i = 0; i < n - value.length(); i++) { sb.append("0"); sb.append(value); return sb.toString(); ... |
String | zeroPadLeft(String s, final int len) zero Pad Left s = s.trim(); if (s.length() > len) { return s; int fll = len - s.length(); final char[] charArray = new char[len]; int index = 0, res = fll / 65; while (res > 0) { ... |
String | zeropadRight(String s, int len) zeropad Right StringBuilder d = new StringBuilder(s); while (d.length() < len) d.append('0'); return d.toString(); |
String | zeroPadSSN(String ssn) zero Pad SSN int ssnInt = Integer.parseInt(ssn); return String.format("%09d", ssnInt); |
String | zeroPadString(String string, int length) Pads the supplied String with 0's to the specified length and returns the result as a new String. StringBuffer buf = new StringBuffer(length); buf.append(zeroArray, 0, length - string.length()).append(string); return buf.toString(); |
String | zeroPadString(String string, int length) Pads the supplied String with 0's to the specified length and returns the result as a new String. if (string == null || string.length() > length) { return string; StringBuilder buf = new StringBuilder(length); buf.append(zeroArray, 0, length - string.length()).append(string); return buf.toString(); |
String | zeroPadString(String string, int length) zero Pad String if (string == null || string.length() > length) { return string; StringBuilder buf = new StringBuilder(length); buf.append(zeroArray, 0, length - string.length()).append(string); return buf.toString(); |