Java String Sub String substring(String string, String beginning, String end)

Here you can find the source of substring(String string, String beginning, String end)

Description

substring

License

Open Source License

Declaration

public static String substring(String string, String beginning, String end) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String substring(String string, String beginning, String end) {
        if (!string.contains(beginning) || !string.contains(end)
                || string.indexOf(beginning) >= string.indexOf(end))
            return null;
        else {/*from   w  w  w.  java  2 s  . c  o  m*/
            String after_beginning = string.substring(string.indexOf(beginning) + beginning.length());
            return after_beginning.substring(0, after_beginning.indexOf(end));
        }
    }
}

Related

  1. subString(String string, int beginIndex, int length)
  2. subString(String string, int index)
  3. substring(String string, int init, int end)
  4. substring(String string, int maxChars, String suffix)
  5. substring(String string, int start, int length)
  6. subString(String string, String inizio, String fine)
  7. substring(String subject, int start, int end)
  8. substring(String text, int begin, int end)
  9. substring(String text, int start, int end)