@Test public void testSubstringAfterLast() { Assert.assertEquals(StringHelper.substringAfterLast(null, "*"), null); Assert.assertEquals(StringHelper.substringAfterLast("", "*"), ""); Assert.assertEquals(StringHelper.substringAfterLast("*", ""), ""); Assert.assertEquals(StringHelper.substringAfterLast("*", null), ""); Assert.assertEquals(StringHelper.substringAfterLast("abc", "a"), "bc"); Assert.assertEquals(StringHelper.substringAfterLast("abcba", "b"), "a"); Assert.assertEquals(StringHelper.substringAfterLast("abc", "c"), ""); Assert.assertEquals(StringHelper.substringAfterLast("a", "a"), ""); Assert.assertEquals(StringHelper.substringAfterLast("a", "z"), ""); }
public static String substringAfterLast(final String str, final String separator) { if (isEmpty(str)) { return str; } if (isEmpty(separator)) { return BasicConstants.EMPTY_STRING; } final int pos = str.lastIndexOf(separator); if ((pos == INDEX_NOT_FOUND) || (pos == (str.length() - separator.length()))) { return BasicConstants.EMPTY_STRING; } return str.substring(pos + separator.length()); }
StringHelper { public static String substringAfterLast(final String str, final String separator) { if (isEmpty(str)) { return str; } if (isEmpty(separator)) { return BasicConstants.EMPTY_STRING; } final int pos = str.lastIndexOf(separator); if ((pos == INDEX_NOT_FOUND) || (pos == (str.length() - separator.length()))) { return BasicConstants.EMPTY_STRING; } return str.substring(pos + separator.length()); } }
StringHelper { public static String substringAfterLast(final String str, final String separator) { if (isEmpty(str)) { return str; } if (isEmpty(separator)) { return BasicConstants.EMPTY_STRING; } final int pos = str.lastIndexOf(separator); if ((pos == INDEX_NOT_FOUND) || (pos == (str.length() - separator.length()))) { return BasicConstants.EMPTY_STRING; } return str.substring(pos + separator.length()); }  }
StringHelper { public static String substringAfterLast(final String str, final String separator) { if (isEmpty(str)) { return str; } if (isEmpty(separator)) { return BasicConstants.EMPTY_STRING; } final int pos = str.lastIndexOf(separator); if ((pos == INDEX_NOT_FOUND) || (pos == (str.length() - separator.length()))) { return BasicConstants.EMPTY_STRING; } return str.substring(pos + separator.length()); }  static String defaultString(final String str); static boolean equals(final String str1, final String str2); static boolean equalsIgnoreCase(final String str1, final String str2); static boolean isBlank(final String str); static boolean isNotBlank(final String str); static String[] split(final String str, final String separatorChars); static String substringAfterLast(final String str,
			final String separator); static final List<String> parseListPreferenceValue(
			String pRawValues, String separator); static String stripAccents(String input); static String replace(String text, String searchString,
			String replacement, int max); }
StringHelper { public static String substringAfterLast(final String str, final String separator) { if (isEmpty(str)) { return str; } if (isEmpty(separator)) { return BasicConstants.EMPTY_STRING; } final int pos = str.lastIndexOf(separator); if ((pos == INDEX_NOT_FOUND) || (pos == (str.length() - separator.length()))) { return BasicConstants.EMPTY_STRING; } return str.substring(pos + separator.length()); }  static String defaultString(final String str); static boolean equals(final String str1, final String str2); static boolean equalsIgnoreCase(final String str1, final String str2); static boolean isBlank(final String str); static boolean isNotBlank(final String str); static String[] split(final String str, final String separatorChars); static String substringAfterLast(final String str,
			final String separator); static final List<String> parseListPreferenceValue(
			String pRawValues, String separator); static String stripAccents(String input); static String replace(String text, String searchString,
			String replacement, int max);  }