![](/img/trans.png)
[英]How can I convert string to bit then split it in half and do some function on a part and then xor it with the other then swap using java?
[英]Java How to select half part of string?
我有这样的字符串:
<html>
<body>
<p>Hello</p>
</body>
</html>
在java中,我希望选择字符串如下所示:
<p>Hello</p>
怎么样?
这一行应该做到这一点:
String text = input.replaceAll("(?s).*(<p>.*</p>).*", "$1");
或仅将所有内容保存在<body>
标记中,请执行以下操作:
String text = input.replaceAll("(?s).*<body>(.*)</body>.*", "$1");
您可以使用JSoup ,它将对您很方便。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.