【问题标题】:How extract the data from a list?如何从列表中提取数据?
【发布时间】:2013-10-22 04:36:52
【问题描述】:

我正在开发一个 Android 应用程序,我想识别主题标签、提及和链接。我有一个可以在我的建议中使用的 Objective-C 代码。我质疑these,现在我有这些代码:

import java.net.URL;
import java.util.List;

String input = /* text from edit text */;

String[] words = input.split("\\s");
List<URL> urls=null;

for (String s : words){
try 
{
    urls.add(new URL(s));
}
catch (MalformedURLException e) {
    // not a url
}

}

现在我想把这些放在推文上,我已经开发了代码来做这件事,推文是基于一个字符串的。 我的问题是如何将列表中的数据放入字符串中?

//I test these
String tweet="Using my app"+urls

但在推文中出现“Using my appnull”

我如何重用此代码来识别主题标签和提及?

I think that is changing the input.split("\\s") by "@\\s" or "#\\s"

【问题讨论】:

    标签: java android tweets


    【解决方案1】:

    你可以在这里使用一个库: https://github.com/twitter/twitter-text-java 这就是你想要做的。

    【讨论】:

    • 比重新发明轮子要好得多。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多