Java String Trim Left ltrim(String src, char ch, int nLen)

Here you can find the source of ltrim(String src, char ch, int nLen)

Description

ltrim

License

Open Source License

Parameter

Parameter Description
src a parameter
ch a parameter
nLen a parameter

Declaration

public static String ltrim(String src, char ch, int nLen) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*  w w  w  . ja v  a  2s .c  o  m*/
     * 
     * 
     * @param src 
     * @param ch 
     * @param nLen 
     * @return
     */
    public static String ltrim(String src, char ch, int nLen) {
        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;
        }

        char[] czRet = new char[n - i];
        for (j = 0; i < czSrc.length; i++, j++)
            czRet[j] = czSrc[i];

        return new String(czRet);
    }
}

Related

  1. ltrim(String s, char character)
  2. ltrim(String s, Character c)
  3. ltrim(String source)
  4. ltrim(String source)
  5. ltrim(String source)
  6. ltrim(String str)
  7. ltrim(String str)
  8. ltrim(String str)
  9. ltrim(String str)