@Test public void testTruncateString() { assertEquals(StaticStringUtils.truncate("0123456789", 4), "0123"); assertEquals(StaticStringUtils.truncate("0123456789", 5), "01234"); assertEquals(StaticStringUtils.truncate("0123456789", 6), "012345"); assertEquals(StaticStringUtils.truncate("01234", 1024), "0123"); }
public static String truncate(String stringIn, int maxLen) { if (stringIn == null) { return stringIn; } return stringIn.substring(0, Math.min(maxLen, stringIn.length() - 1)); }
StaticStringUtils { public static String truncate(String stringIn, int maxLen) { if (stringIn == null) { return stringIn; } return stringIn.substring(0, Math.min(maxLen, stringIn.length() - 1)); } }
StaticStringUtils { public static String truncate(String stringIn, int maxLen) { if (stringIn == null) { return stringIn; } return stringIn.substring(0, Math.min(maxLen, stringIn.length() - 1)); }  }
StaticStringUtils { public static String truncate(String stringIn, int maxLen) { if (stringIn == null) { return stringIn; } return stringIn.substring(0, Math.min(maxLen, stringIn.length() - 1)); }  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 truncate(String stringIn, int maxLen) { if (stringIn == null) { return stringIn; } return stringIn.substring(0, Math.min(maxLen, stringIn.length() - 1)); }  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);  }