@Test public void testRchop_01() { assertEquals("01", null, StringUtil.rchop(null, null)); assertEquals("02", null, StringUtil.rchop(null, "old")); assertEquals("03", "blabla", StringUtil.rchop("blabla", null)); assertEquals("04", "", StringUtil.rchop("", "bla")); assertEquals("05", "", StringUtil.rchop("blabla", "bla")); assertEquals("06", "less", StringUtil.rchop("lessblabla", "bla")); assertEquals("07", "blablaless", StringUtil.rchop("blablalessblabla", "bla")); }
public static String rchop(String string, String word) { if (string == null) return null; if (word == null) return string; while (string.endsWith(word)) string = string.substring(0, string.length() - word.length()); return string; }
StringUtil { public static String rchop(String string, String word) { if (string == null) return null; if (word == null) return string; while (string.endsWith(word)) string = string.substring(0, string.length() - word.length()); return string; } }
StringUtil { public static String rchop(String string, String word) { if (string == null) return null; if (word == null) return string; while (string.endsWith(word)) string = string.substring(0, string.length() - word.length()); return string; }  }
StringUtil { public static String rchop(String string, String word) { if (string == null) return null; if (word == null) return string; while (string.endsWith(word)) string = string.substring(0, string.length() - word.length()); return string; }  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 rchop(String string, String word) { if (string == null) return null; if (word == null) return string; while (string.endsWith(word)) string = string.substring(0, string.length() - word.length()); return string; }  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; }