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);
}
}
Download apache-lang common from apache jakarta sie:
http://commons.apache.org/lang/
After getting jar file please put this jar in your project's build path, if you are not able to find build path then go Jdeveloper help file and type "build path" and you will get all intrustion over there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With