Here you can find the source of leftTrim(String input, char charToTrim)
public static String leftTrim(String input, char charToTrim)
//package com.java2s; /*/*ww w . ja va2 s . co m*/ * @author Fabio Zadrozny * Created: June 2005 * License: Common Public License v1.0 */ public class Main { /** * Removes whitespaces at the end of the string. */ public static String leftTrim(String input) { int len = input.length(); int off = 0; char[] val = input.toCharArray(); while ((off < len) && (val[off] <= ' ')) { off++; } return input.substring(off, len); } /** * Removes the occurrences of the passed char in the end of the string. */ public static String leftTrim(String input, char charToTrim) { int len = input.length(); int off = 0; char[] val = input.toCharArray(); while ((off < len) && (val[off] == charToTrim)) { off++; } return input.substring(off, len); } }