Java examples for java.lang:String Pad
remove Left Pad
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { String str = "java2s.com"; String pad = "com"; System.out.println(removeLeftPad(str, pad)); }/*w w w. j a v a 2 s. co m*/ public static String removeLeftPad(String str, String pad) { while (str.startsWith(pad)) { str = str.replaceFirst(pad, ""); } return str; } }