小编use*_*779的帖子

无法使用org.apache.commons.lang.StringUtils包

我是Jdeveloper的新手,我正在编写一个在两个字符串之间使用文本的程序.我偶然发现了StringUtils.substringBetween()函数,但是当我编译程序时,它说它找不到变量StringUtils并且无法识别org.apache.commons.lang.StringUtils包.请告诉我哪里出错了.我认为有一件事是库中没有包,但由于我是新手,我不知道如何安装这样的包或在哪里安装.我使用的是jdev 10.1.3.5.0.我在网上偶然发现的代码是这样的:

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);
    }
}
Run Code Online (Sandbox Code Playgroud)

java jdeveloper package

9
推荐指数
2
解决办法
4万
查看次数

标签 统计

java ×1

jdeveloper ×1

package ×1