Here you can find the source of ltrim(String s, char character)
public static String ltrim(String s, char character)
//package com.java2s; //License from project: MIT License public class Main { public static String ltrim(String s) { int i = 0; while (i < s.length() && Character.isWhitespace(s.charAt(i))) { i++;//from ww w . j av a 2 s . c o m } return i(s, i); } public static String ltrim(String s, char character) { int i = 0; while (i < s.length() && s.charAt(i) == character) { i++; } return i(s, i); } public static String i(String s, int begin, int end) { if (s == null) return null; int len = s.length(); if (begin < 0) begin += len; if (end < 0) end += len; if (begin < 0) begin = 0; if (end < 0) end = 0; if (begin >= len) return ""; if (end > len) end = len; if (end <= begin) return ""; return s.substring(begin, end); } public static String i(String s, int begin) { return i(s, begin, s.length()); } }