@Test public void testLtrim_01() { assertEquals("01 Should be empty.", "", StringUtil.ltrim(null, 'a')); assertEquals("02 Should be empty.", "", StringUtil.ltrim("", 'a')); assertEquals("03 Should be empty.", "", StringUtil.ltrim("a", 'a')); assertEquals("04 Should be empty.", "", StringUtil.ltrim("aa", 'a')); assertEquals("05 Should be empty.", "", StringUtil.ltrim("aaa", 'a')); assertEquals("06 Should be \"b\".", "b", StringUtil.ltrim("b", 'a')); assertEquals("07 Should be \"b\".", "b", StringUtil.ltrim("aaab", 'a')); assertEquals("08 Should be \"bb\".", "bb", StringUtil.ltrim("aaabb", 'a')); assertEquals("09 Should be \"bb\".", "bb", StringUtil.ltrim("bb", 'a')); assertEquals("10 Should be \"bba\".", "bba", StringUtil.ltrim("bba", 'a')); assertEquals("11 Should be \"bbaa\".", "bbaa", StringUtil.ltrim("bbaa", 'a')); }
public static String ltrim(String s, char c) { if (s == null) return EMPTY; int i; for (i = 0; i < s.length() && s.charAt(i) == c; ++i) {} return i == s.length() ? EMPTY : s.substring(i); }
StringUtil { public static String ltrim(String s, char c) { if (s == null) return EMPTY; int i; for (i = 0; i < s.length() && s.charAt(i) == c; ++i) {} return i == s.length() ? EMPTY : s.substring(i); } }
StringUtil { public static String ltrim(String s, char c) { if (s == null) return EMPTY; int i; for (i = 0; i < s.length() && s.charAt(i) == c; ++i) {} return i == s.length() ? EMPTY : s.substring(i); }  }
StringUtil { public static String ltrim(String s, char c) { if (s == null) return EMPTY; int i; for (i = 0; i < s.length() && s.charAt(i) == c; ++i) {} return i == s.length() ? EMPTY : s.substring(i); }  static String substr(String string, int from); static String substr(String string, int from, int length); static String zpad(Object obj, int width, String separator); static String zpad(Object obj, int width); static String lpad(Object obj, int width, String separator); static String pad(Object obj, int width); static String pad(Object obj, int width, char padChar); static String pad(Object obj, int width, char padChar, String separator); static String lpad(Object obj, int width); static String lpad(Object obj, int width, char padChar); static String lpad(Object obj, int width, char padChar, String separator); static String rpad(Object obj, int width, String separator); static String rpad(Object obj, int width); static String rpad(Object obj, int width, char padChar); static String rpad(Object obj, int width, char padChar, String separator); static String substring(String string, int from, int to); static String toString(byte[] bytes); static String lchop(String string, String word); static String rchop(String string, String word); static String[] split(String s, String delim); static String[] split(String s, String delim, int numParts); static String trim(String s, char c); static String ltrim(String s, char c); static String trim(String s, char... chars); static String trim(String s, String chars); static String rtrim(String s, char c); static boolean isTrue(String s); static boolean isTrue(String s, boolean dfault); static String getResourceAsString(String path); static InputStream toInputStream(String s); static InputStream toInputStream(String s, String charset); static String fromInputStream(InputStream is); static String fromInputStream(InputStream is, String charset); static String fromInputStream(InputStream is, String charset, int bufsize); static int toInt(String s); static String emptyIfNull(String str); }
StringUtil { public static String ltrim(String s, char c) { if (s == null) return EMPTY; int i; for (i = 0; i < s.length() && s.charAt(i) == c; ++i) {} return i == s.length() ? EMPTY : s.substring(i); }  static String substr(String string, int from); static String substr(String string, int from, int length); static String zpad(Object obj, int width, String separator); static String zpad(Object obj, int width); static String lpad(Object obj, int width, String separator); static String pad(Object obj, int width); static String pad(Object obj, int width, char padChar); static String pad(Object obj, int width, char padChar, String separator); static String lpad(Object obj, int width); static String lpad(Object obj, int width, char padChar); static String lpad(Object obj, int width, char padChar, String separator); static String rpad(Object obj, int width, String separator); static String rpad(Object obj, int width); static String rpad(Object obj, int width, char padChar); static String rpad(Object obj, int width, char padChar, String separator); static String substring(String string, int from, int to); static String toString(byte[] bytes); static String lchop(String string, String word); static String rchop(String string, String word); static String[] split(String s, String delim); static String[] split(String s, String delim, int numParts); static String trim(String s, char c); static String ltrim(String s, char c); static String trim(String s, char... chars); static String trim(String s, String chars); static String rtrim(String s, char c); static boolean isTrue(String s); static boolean isTrue(String s, boolean dfault); static String getResourceAsString(String path); static InputStream toInputStream(String s); static InputStream toInputStream(String s, String charset); static String fromInputStream(InputStream is); static String fromInputStream(InputStream is, String charset); static String fromInputStream(InputStream is, String charset, int bufsize); static int toInt(String s); static String emptyIfNull(String str); static final String EMPTY; }