Java Utililty Methods String Trim Left

List of utility methods to do String Trim Left

Description

The list of methods to do String Trim Left are organized into topic(s).

Method

Stringltrim(String s)
Remove all leading blanks.
int index = 0;
while (index < s.length() && isSpace(s.charAt(index)))
    index++;
return s.substring(index, s.length());
Stringltrim(String s)
ltrim
int i = 0;
while (i < s.length() && Character.isWhitespace(s.charAt(i)))
    i++;
return s.substring(i);
Stringltrim(String s)
Does left trim.
if (s == null)
    return null;
int len = s.length();
int st = 0;
while ((st < len) && (s.charAt(st) <= ' ')) {
    st++;
return ((st > 0) ? s.substring(st) : s);
...
Stringltrim(String s)
Left trims a string.
if (s == null)
    return null;
for (int k = 0; k < s.length(); k++) {
    if (!Character.isWhitespace(s.charAt(k)))
        return (k == 0 ? s : s.substring(k));
return "";
Stringltrim(String s, char character)
ltrim
int i = 0;
while (i < s.length() && s.charAt(i) == character) {
    i++;
return i(s, i);
Stringltrim(String s, Character c)
ltrim
if (s == null) {
    return null;
if (c == null) {
    return s;
int len = s.length();
int st = 0;
...
Stringltrim(String source)
ltrim
return source.replaceAll("^\\s+", "");
Stringltrim(String source)
remove leading whitespace
return source.replaceAll("^\\s+", "");
Stringltrim(String source)
Left trim: remove spaces to the left of a String.
if (source == null)
    return null;
int from = 0;
while (from < source.length() && isSpace(source.charAt(from)))
    from++;
return source.substring(from);
Stringltrim(String src, char ch, int nLen)
ltrim
if (src == null || src.length() <= nLen)
    return src;
char[] czSrc = src.toCharArray();
int i, j;
int n = czSrc.length;
for (i = 0; (n - i) > nLen; i++) {
    if (czSrc[i] != ch)
        break;
...