Java String Sub String substringAfterLast(final String str, final String separator)

Here you can find the source of substringAfterLast(final String str, final String separator)

Description

substring After Last

License

Apache License

Declaration

public static String substringAfterLast(final String str, final String separator) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String substringAfterLast(final String str, final String separator) {
        if (str == null) {
            return null;
        }// w ww .  j  ava  2 s . co m
        final int pos = str.lastIndexOf(separator);
        if (pos == -1 || pos == (str.length() - separator.length())) {
            return "";
        }
        return str.substring(pos + separator.length());
    }
}

Related

  1. substringAfter(String text, String after)
  2. substringAfter(String value, char delim)
  3. substringAfterFirstIndex(String value)
  4. substringAfterIfExist(String source, String rev)
  5. subStringAfterIgnoreCase(String str, String separator, Integer num)
  6. substringAfterLast(final String str, final String separator)
  7. substringAfterLast(final String value, final String searchValue)
  8. substringAfterLast(String input, String delimiter)
  9. substringAfterLast(String str, String pattern)