Write code to trim a string from Left with specified character
//package com.book2s; public class Main { public static void main(String[] argv) { String s = "book2s.com"; System.out.println(trimLeft(s)); }/*from w w w. java2 s .co m*/ public static String trimLeft(String s) { return trimLeft(s, ' '); } public static String trimLeft(String s, Character c) { final int length = s.length(); int i = 0; while (i < length && s.charAt(i) <= c) { ++i; } return s.substring(i); } }