Java 从字符串到Int的JSoup

Java 从字符串到Int的JSoup,java,android,jsoup,Java,Android,Jsoup,我在android studio中与JSoup一起工作。在我的代码中,我有: Elements description = document.select("something"); 如果我这样做- 一切正常 但如果我这样做- 为什么我的应用程序会崩溃 我所有的代码: public Void doInBackground(Void... params) { try { // Connect to the web site Docu

我在android studio中与JSoup一起工作。在我的代码中,我有:

Elements description = document.select("something");
如果我这样做-

一切正常

但如果我这样做-

为什么我的应用程序会崩溃

我所有的代码:

public Void doInBackground(Void... params) {
        try {
            // Connect to the web site
            Document document = Jsoup
                    .connect("something")
                    .userAgent("Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko")
                    .get();
            Elements description = document.select("something");

            String foo = description.text();
            int fuu = Integer.parseInt(foo);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }

请尝试
intfoo=Integer.parse(description.ownText())

如果没有堆栈跟踪和原始HTML或URL,几乎不可能说出代码中发生了什么。然而,我看到了崩溃的一种可能性,那就是字符串不包含有效的数字。由于您声明字符串的打印输出实际上打印出“65”,我只能假设该字符串可能使用奇怪的uft8 unicode字符,这些字符看起来像或是数字,但不能用Integer.parseInt(字符串)解释


例如,如果你的输入字符串是“ValueQuest:Stest.To())不是一个有效的整数:整数。PARSETIN(描述。文本())。;
要查看是否有空格等其他字符,description.text()返回“65”。能否发布HTML的相关部分以及提取方式?
int y = Integer.parseInt(description.text());
public Void doInBackground(Void... params) {
        try {
            // Connect to the web site
            Document document = Jsoup
                    .connect("something")
                    .userAgent("Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko")
                    .get();
            Elements description = document.select("something");

            String foo = description.text();
            int fuu = Integer.parseInt(foo);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }