Java String Tail tailOfString(String input, String sub)

Here you can find the source of tailOfString(String input, String sub)

Description

Returns everything to the right of the specified string.

License

Open Source License

Declaration

public static String tailOfString(String input, String sub) 

Method Source Code

//package com.java2s;

public class Main {
    /** Returns everything to the right of the specified string.
    *//*ww w.  ja va2 s  .  c o m*/
    public static String tailOfString(String input, String sub) {
        String retString = null;
        if (input != null) {
            int lastIdx = input.indexOf(sub);
            if (lastIdx != -1)
                retString = input.substring(lastIdx + sub.length());
            else
                retString = input;
        }
        return retString;
    }
}

Related

  1. tail(String s, char ch)
  2. tail(String s, String separator)
  3. tail(String src, String dividerRegex)
  4. tail(String text, String separator)
  5. tailOf(String s, char separator)