List of utility methods to do String Trim Left
String | ltrim(String str) ltrim if (!hasLength(str)) { return str; StringBuilder sb = new StringBuilder(str); while (sb.length() > 0 && Character.isWhitespace(sb.charAt(0))) { sb.deleteCharAt(0); return sb.toString(); ... |
String | ltrim(String str) ltrim return ltrim(str, " "); |
String | ltrim(String str) ltrim int index = 0; while (' ' == str.charAt(index++)) ; if (index > 0) str = str.substring(index - 1); return str; |
String | ltrim(String str) ltrim int i = 0; while (i < str.length()) { switch (str.charAt(i)) { case ' ': case '\t': i++; continue; break; return str.substring(i); |
String | ltrim(String str, String charList) ltrim int start = 0, len = str.length(); if (null == charList) for (int i = 0; i < len; i++) if (Character.isWhitespace(str.charAt(i))) start++; else break; else ... |
String | ltrim(String str, String defaultValue) This function returns a string with whitespace stripped from the beginning of str if (str == null) return defaultValue; int len = str.length(); int st = 0; while ((st < len) && (str.charAt(st) <= ' ')) { st++; return ((st > 0)) ? str.substring(st) : str; ... |
String | ltrim(String text, char c) ltrim if (text == null) { return EMPTY; int i = 0; int length = text.length(); while ((i < length) && (text.charAt(i) == c)) { i++; return (i > 0 ? text.substring(i) : text); |
int | ltrimCount(final String input) ltrim Count if (input == null) return 0; if (input.isEmpty()) return 0; int i = 0; while (i < input.length() && input.charAt(i) == ' ') ++i; return i; ... |
String | ltrimNewline(String s) Trims specified string from left and stop at \n character
if (s == null) { return null; int index = 0; int len = s.length(); while (index < len && Character.isWhitespace(s.charAt(index))) { if (s.charAt(index) == '\n') { break; ... |
String | ltrimZero(String inputString) ltrim Zero boolean findNonZero = false; char paddingArr[] = inputString.trim().toCharArray(); StringBuffer sf = new StringBuffer(); for (int i = 0; i < paddingArr.length; i++) { if (!findNonZero) { sf.append(paddingArr[i]); } else if (findNonZero && (paddingArr[i] != '0')) { sf.append(paddingArr[i]); ... |