誰でも助けてくれますか?Java Seleniumで段落に分割する方法はありますか?各テキストブロック(段落)を抽出する必要があります。基本的には、テキストの行間に改行があるときに段落を抽出する必要があります。 サンプルテキストは、次のとおりです。段落にテキストを分割する方法
Description of rules
SAM/CAD are need to be discussed.
The required codes needed to be provided with accurate information.
Restricted:
- Smoking in the public place
- drink alcohol in the public places.
- Scream and make violations
SAM Setting:
not allowed
言い換えれば、それは段落に分割されていない、動作していない私のコード、:
String text=driver.findElement(By.xpath(".//*[@id='Content_tdMainContent']")).getText();
String[] eachSentence=text.split("^\\s*$");
空の行 '^ \ s * $'に分割しますか? [regex101のこちらをご覧ください](https://regex101.com/r/0XGVxb/1)。 – ClasG
それは動作していません –
@ S.Dase私は、全体の問題はどこからでも得ることができ、Javaに関連する 'text'を分割することだと思います。それはどのように 'セレン'にリンクされていますか? – DebanjanB