gpt4 book ai didi

Java如何查看一个String是否包含多个单词?

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:05:21 25 4
gpt4 key购买 nike

<分区>

我的问题是,我如何判断 html 是否包含字符串中的任何内容,下面的内容不起作用。它抛出不兼容的类型:java.lang.String[]

    public void run() {
Document doc;
String[] matches = new String[]{"Unavailable", "Too Short", "skin-3d"};
try {
BufferedWriter writer = new BufferedWriter(new FileWriter("output.txt", true));
//Thread.sleep(3000);
doc = Jsoup.connect("https://t.com/s/" + line).userAgent("Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0")
.referrer("http://www.google.com").ignoreHttpErrors(true).get();
//Elements ID = doc.getElementsByClass("card-header");
String html = doc.html();
if (!html.contains(matches)) {
System.out.println(line + " taken");
System.out.println(line + " is available or is only two chars");
writer.write(line + "\n");
writer.close();

} else {
System.out.println(line + " taken");
writer.close();
}
} catch (IOException e1) {
e1.printStackTrace();
}

}
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com