@Test public void testLpad() { assertEquals(StaticStringUtils.lpad("123", "0", 10), "0000000123"); assertEquals(StaticStringUtils.lpad("123", "*", 5), "**123"); assertEquals(StaticStringUtils.lpad("123", "*", 1), "123"); }
public static String lpad(String val, String pad, int npad) { StringBuilder sb = new StringBuilder(); int nspaces = npad - val.length(); for (int i = 0; i < nspaces; i++) { sb.append(pad); } sb.append(val); return sb.toString(); }
StaticStringUtils { public static String lpad(String val, String pad, int npad) { StringBuilder sb = new StringBuilder(); int nspaces = npad - val.length(); for (int i = 0; i < nspaces; i++) { sb.append(pad); } sb.append(val); return sb.toString(); } }
StaticStringUtils { public static String lpad(String val, String pad, int npad) { StringBuilder sb = new StringBuilder(); int nspaces = npad - val.length(); for (int i = 0; i < nspaces; i++) { sb.append(pad); } sb.append(val); return sb.toString(); }  }
StaticStringUtils { public static String lpad(String val, String pad, int npad) { StringBuilder sb = new StringBuilder(); int nspaces = npad - val.length(); for (int i = 0; i < nspaces; i++) { sb.append(pad); } sb.append(val); return sb.toString(); }  static String lpadLong(long val, String pad, int npad); static String lpad(String val, String pad, int npad); static String getExtendedStackTrace(Throwable th); static String mapToString(Map<K, V> map, String delimiter); static String collectionToString(Collection<T> collection, String delimiter); static String truncate(String stringIn, int maxLen); static String mapToString(Map<K, V> mapIn); static String stripCRLF(String line); static String[] stripBlankArgs(String line); static Map<String, String> argMapper(String[] args); static String[] stripKwArgs(String[] args); static String justOneCR(String strIn); static String showDiff(String a, String b); }
StaticStringUtils { public static String lpad(String val, String pad, int npad) { StringBuilder sb = new StringBuilder(); int nspaces = npad - val.length(); for (int i = 0; i < nspaces; i++) { sb.append(pad); } sb.append(val); return sb.toString(); }  static String lpadLong(long val, String pad, int npad); static String lpad(String val, String pad, int npad); static String getExtendedStackTrace(Throwable th); static String mapToString(Map<K, V> map, String delimiter); static String collectionToString(Collection<T> collection, String delimiter); static String truncate(String stringIn, int maxLen); static String mapToString(Map<K, V> mapIn); static String stripCRLF(String line); static String[] stripBlankArgs(String line); static Map<String, String> argMapper(String[] args); static String[] stripKwArgs(String[] args); static String justOneCR(String strIn); static String showDiff(String a, String b);  }