List of utility methods to do String Pad Left
String | leftPad(String s, int length) Returns a copy of s padded with leading spaces so that it's length is length .
StringBuffer sb = new StringBuffer(); for (int i = length - s.length(); i > 0; i--) sb.append(" "); sb.append(s); return sb.toString(); |
String | leftPad(String s, int length) left Pad if (s == null) s = ""; if (s.length() > length) return s.substring(0, length); return repeat(" ", length - s.length()) + s; |
String | leftPad(String s, int minLength) Pads the string at the left with spaces until it reaches the desired length. return leftPad(s, minLength, ' '); |
String | leftPad(String s, int n) left Pad return String.format("%1$#" + n + "s", s); |
String | leftPad(String s, int target) Node.js lol return leftPad(s, target, ' '); |
String | leftPad(String s, int width) Left pad a string s to Width. String tmp = ""; int npad = width - s.length(); if (npad < 0) tmp = s.substring(0, width); else if (npad == 0) tmp = s; else { for (int i = 0; i < npad; i++) ... |
String | leftPad(String s, int z) Left pad a String with spaces. return leftPad(s, z, " "); |
String | leftPad(String srcStr, char padChar, int destLen) left Pad if (srcStr == null) { return genStr(padChar, destLen); } else if (srcStr.length() < destLen) { StringBuilder destSrc = new StringBuilder(destLen); destSrc.append(srcStr); for (int i = srcStr.length(); i < destLen; i++) { destSrc.insert(0, padChar); return destSrc.toString(); } else { return srcStr; |
String | leftPad(String srcString, char c, int length) left Pad if (srcString == null) { srcString = ""; int tLen = srcString.length(); if (tLen >= length) return srcString; int iMax = length - tLen; StringBuilder sb = new StringBuilder(); ... |
String | leftPad(String srcString, char c, int length) left Pad if (srcString == null) { srcString = ""; int tLen = srcString.length(); if (tLen >= length) return srcString; int iMax = length - tLen; StringBuffer sb = new StringBuffer(); ... |