@Nullable private static String _getUntilLast (@Nullable final String sStr, final char cSearch, final boolean bIncludingSearchChar) { final int nIndex = getLastIndexOf (sStr, cSearch); return nIndex == STRING_NOT_FOUND ? null : sStr.substring (0, nIndex + (bIncludingSearchChar ? 1 : 0)); }
@Nullable private static String _getFromLast (@Nullable final String sStr, final char cSearch, final boolean bIncludingSearchChar) { final int nIndex = getLastIndexOf (sStr, cSearch); return nIndex == STRING_NOT_FOUND ? null : sStr.substring (nIndex + (bIncludingSearchChar ? 0 : 1)); }
/** * Get the last token from (and excluding) the separating character. * * @param sStr * The string to search. May be <code>null</code>. * @param cSearch * The search character. * @return The passed string if no such separator token was found. */ @Nullable public static String getLastToken (@Nullable final String sStr, final char cSearch) { final int nIndex = getLastIndexOf (sStr, cSearch); return nIndex == StringHelper.STRING_NOT_FOUND ? sStr : sStr.substring (nIndex + 1); }
@Nullable private static String _getFromLast (@Nullable final String sStr, @Nullable final String sSearch, final boolean bIncludingSearchString) { if (hasNoText (sSearch)) return sStr; final int nIndex = getLastIndexOf (sStr, sSearch); return nIndex == STRING_NOT_FOUND ? null : sStr.substring (nIndex + (bIncludingSearchString ? 0 : sSearch.length ())); }
@Nullable private static String _getUntilLast (@Nullable final String sStr, @Nullable final String sSearch, final boolean bIncludingSearchChar) { if (hasNoText (sSearch)) return ""; final int nIndex = getLastIndexOf (sStr, sSearch); return nIndex == STRING_NOT_FOUND ? null : sStr.substring (0, nIndex + (bIncludingSearchChar ? sSearch.length () : 0)); }
/** * Get the last token from (and excluding) the separating string. * * @param sStr * The string to search. May be <code>null</code>. * @param sSearch * The search string. May be <code>null</code>. * @return The passed string if no such separator token was found. */ @Nullable public static String getLastToken (@Nullable final String sStr, @Nullable final String sSearch) { if (StringHelper.hasNoText (sSearch)) return sStr; final int nIndex = getLastIndexOf (sStr, sSearch); return nIndex == StringHelper.STRING_NOT_FOUND ? sStr : sStr.substring (nIndex + getLength (sSearch)); }