Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {
    public static String sub(String begin, String end, String src) throws Exception {
        int indexBegin = src.indexOf(begin);
        if (indexBegin != -1) {
            String sub = src.substring(indexBegin + begin.length());
            if (end == null) {
                return sub;
            }
            int indexEnd = sub.indexOf(end);
            if (indexEnd != -1) {
                return sub.substring(0, indexEnd);
            }
        }
        return null;
    }
}