我有 Html 字符串,我只想从中提取图像路径。任何人都可以有想法吗?
这是我的 HTML 字符串
'<p>Testing Android <img alt="" src="http://111.90.169.104/Testing/Images/Item/Prachi%202120160730161908694.jpeg" style="width: 960px; height: 614px;" /></p>'
最佳答案
您需要使用 Regex 来解决此问题此代码可能对您有用 .
首先将您的 html 添加到字符串中
String html;
使用这段代码
Pattern p = Pattern.compile("src=\"(.*?)\""); Matcher m = p.matcher(html); while(m.find()){ //Displaying the url System.out.println(m.group(1));}
关于android - 从 Html 标签中提取图像路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38888271/