【问题标题】:Android find the address in the html bodyAndroid在html正文中查找地址
【发布时间】:2014-03-10 13:07:52
【问题描述】:

我有带有标题、作者、描述和正文的 RSS 提要。我将它们显示在 Android 网络视图中。 我需要查找正文是否有邮寄地址。如果它在那里,我需要显示它们突出显示和可点击,这可能会启动一个新页面。 我怎样才能做到这一点? RSS 提要示例:

<title><![CDATA[ NJ ‘computer geek’ latest to file beating claim against Harrah’s A.C. security ]]></title>
                    <author><![CDATA[ Sam Wood <br> PHILLY.COM ]]></author>
                    <description>
                                        </description>


                    <body><![CDATA[   <p><img style='float: left;height: 48px;padding: 0 8px 8px 0;width: 100px;' class='img_noborder partnerBadges' src='http://media.philly.com/designimages/partnerIcon-mobile-Phillycom.jpg' border='0'/></p>                                       <p>A New Jersey computer engineering student is the latest person to claim he was the victim of an unprovoked beating at the hands of security guards at an Atlantic City casino, bringing the total to at least four.</p>
<p>Richard Travellin, 23, filed suit in Bergen County court last week against Harrah&rsquo;s Atlantic City and its parent company, Caesars Entertainment Corp.</p>
<p>Travellin, who his attorney described as a &ldquo;shy computer geek,&rdquo; joins a mother and daughter from Florida and two Atlantic County cab drivers who say poorly trained guards attacked them while on Harrah&rsquo;s property. Each of the alleged attacks was captured on video by Harrah&rsquo;s in-house surveillance cameras.</p>
<p>A spokesman for the casino declined to comment</body>

尸体的地址可能如下:120 morton street, philadelphia, PA

【问题讨论】:

  • 谢谢,但是链接显示了如何设置地址,但我需要在正文中找到哪个是地址。怎么做。我得到的 RSS 提要可能在文本正文中有一个未突出显示的地址。 Android 需要找到地址并将其突出显示。
  • 您首先需要定义如何确定一个单词/字符/数字链是一个地址。
  • 这就是我想知道的。如何检测可以是地址的单词链

标签: android html webview


【解决方案1】:
if (html.toString().contains(struniqID)) {
}

【讨论】:

  • 我不会搜索一个唯一的地址,它可以是任何地址。当您访问时,在网页中说出有时突出显示的地址、电话号码或电子邮件地址,这些地址可能是可点击的。同样,我需要在正文中找出哪个是地址并突出显示它
  • String struniqID="120 morton street, philadelphia, PA"
  • html 字符串你找到了吗?还是你想做的?
  • 字符串可以是任意地址,需要判断body中的chars字符串是不是地址
猜你喜欢
  • 2015-06-30
  • 1970-01-01
  • 1970-01-01
  • 2012-01-31
  • 2014-01-06
  • 2016-05-05
  • 2012-03-16
  • 2018-07-07
  • 1970-01-01
相关资源
最近更新 更多