我正在尝试从以下 html 片段中解析标题:
"Website (Newton) at datanucleus.org">Website</a></div>
我正在使用indexOf
:strLine.indexOf("\">Website")
我想知道如何搜索链接之前出现的第一个空格。所以我想捕获“”和“">网站<”
之间的所有内容即datanucleus.org
有什么想法吗?谢谢!
最佳答案
如果你有 int idx = str.indexOf("\">Website"),你可以使用 String.lastIndexOf("", idx); 来获取前面的空格。然后使用子字符串!
关于java - 如何在Java中使用indexOf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9933051/