JAVA-MANI.BLOGSPOT.COM
Friday, July 25, 2008
In this example we'll use the StringUtils.substringBetween() method. Here we'll extract the title and body of our HTML document. Let's see the code.

package org.kodejava.example.commons.lang;

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

public class NestedString {
public static void main(String[] args) {
String helloHtml = "" +
"" +
" Hello World from Java" +
"" +
"Hello, today is: " + new Date() +
"" +
"";

String title = StringUtils.substringBetween(helloHtml, "", "");
String content = StringUtils.substringBetween(helloHtml, "", "");

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

0 comments:

SUBSCRIBE VIA eMAIL

Enter your email address:

Delivered by FeedBurner

Recent Posts

Firefox 3

Counter

internet companies

Live Traffic Map

Subscribe Now