Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Date;
import org.apache.commons.lang.StringUtils;

public class Main {
    public static void main(String[] args) {
        String helloHtml = "<html>" + "<head>" + "   <title>Hello World from Java</title>" + "<body>"
                + "Hello, today is: " + new Date() + "</body>" + "</html>";

        String title = StringUtils.substringBetween(helloHtml, "<title>", "</title>");
        String content = StringUtils.substringBetween(helloHtml, "<body>", "</body>");

        System.out.println("title = " + title);
        System.out.println("content = " + content);
    }
}