I am new to Jdeveloper and I was writing a program which used text in between two strings. I stumbled upon StringUtils.substringBetween()
function but when I compile the program it says it cannot find variable StringUtils
and does not recognise org.apache.commons.lang.StringUtils
package. Please do tell me where I am going wrong. One thing I thought was the package was missing from the libraries but since I am new I don't know how to install such a package or where to install for that matter. I am using jdev 10.1.3.5.0. The code I stumbled upon on the net is this:
import java.util.Date;
import org.apache.commons.lang.StringUtils;
public class NestedString {
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);
}
}