Java String Trim Left ltrim(final String str)

Here you can find the source of ltrim(final String str)

Description

ltrim

License

Open Source License

Declaration

public static String ltrim(final String str) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String ltrim(final String str) {
        int i;//from   w w  w  . ja v a 2  s . co  m
        int j;
        int x = 0;

        for (i = 0; i < str.length(); i++) {
            char ch = str.charAt(i);
            if (ch != ' ') {
                break;
            }
        }

        final int len = (str.length() - i);
        char[] res = new char[len];
        for (j = i; j < str.length(); j++) {
            res[x++] = str.charAt(j);
        }

        return new String(res, 0, len);
    }
}

Related

  1. leftTrim(String value)
  2. leftTrim(StringBuilder pStringBuilder)
  3. leftTrimSlashes(String s)
  4. ltrim(byte[] a)
  5. ltrim(CharSequence str)
  6. ltrim(final String str, final char filler)
  7. ltrim(final String text)
  8. lTrim(final String value)
  9. ltrim(String list, char[] del)