Java String Trim Left ltrim(String s)

Here you can find the source of ltrim(String s)

Description

Trims specified string from left.

License

Open Source License

Parameter

Parameter Description
s a parameter

Declaration

public static String ltrim(String s) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from w  ww  . ja  v  a  2 s .co  m
     * Trims specified string from left.
     * @param s
     */
    public static String ltrim(String s) {
        if (s == null) {
            return null;
        }

        int index = 0;
        int len = s.length();

        while (index < len && Character.isWhitespace(s.charAt(index))) {
            index++;
        }

        return (index >= len) ? "" : s.substring(index);
    }
}

Related

  1. ltrim(String list, char[] del)
  2. ltrim(String orig)
  3. ltrim(String pString)
  4. ltrim(String s)
  5. ltrim(String s)
  6. ltrim(String s)
  7. ltrim(String s)
  8. lTrim(String s)
  9. ltrim(String s)