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

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

Description

substring After

License

Apache License

Declaration

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

Method Source Code

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

public class Main {
    public static final String EMPTY = "";
    public static final int INDEX_NOT_FOUND = -1;

    public static String substringAfter(final String str, final String separator) {
        if (isEmpty(str)) {
            return str;
        }/*www  . j ava 2 s. co  m*/
        if (separator == null) {
            return EMPTY;
        }
        final int pos = str.indexOf(separator);
        if (pos == INDEX_NOT_FOUND) {
            return EMPTY;
        }
        return str.substring(pos + separator.length());
    }

    public static boolean isEmpty(final CharSequence cs) {
        return cs == null || cs.length() == 0;
    }
}

Related

  1. subString(String val, int start, int end)
  2. SubString(String x, long y)
  3. substring(StringBuffer buf, int start, int lim)
  4. substring2ByteString(String str, int endIndex)
  5. subString4lastIndex(String string, String regex)
  6. substringAfter(String s, String cs)
  7. substringAfter(String s, String substr, boolean fromend)
  8. substringAfter(String sourceStr, String expr)
  9. substringAfter(String str, int beginChar, boolean last)