Java me j2me中的httpconnection stringitem

Java me j2me中的httpconnection stringitem,java-me,Java Me,我编写了一个httpconnection应用程序,它返回网站的标题和链接,并显示在表单/stringtiem上。 既然所有标题现在都连接成一个字符串,显示在一个stringitem上,那个么我如何将标题和链接分开呢 代码如下: String line = results.toString(); int position = line.indexOf("<h2 class=\"cross-head\">"); position = lin

我编写了一个httpconnection应用程序,它返回网站的标题和链接,并显示在表单/stringtiem上。 既然所有标题现在都连接成一个字符串,显示在一个stringitem上,那个么我如何将标题和链接分开呢

代码如下:

String line = results.toString();
            int position = line.indexOf("<h2 class=\"cross-head\">");
            position = line.indexOf(">", position);
            //
            int position2 = line.indexOf("</h3>", position);
            //
            res = line.substring(position + 1, position2);
            //
            while (res.indexOf("<") != -1) {

                int beginTag;
                int endTag;

                beginTag = res.indexOf("<");
                endTag = res.indexOf(">");
                if (beginTag == 0) {
                    res = res.substring(endTag + 1, res.length());
                } else {
                    res = res.substring(0, beginTag)
                            + res.substring(endTag + 1, res.length());
                }
                description = replace(res, "&quot;", "\"");
                description = replace(description, "&nbsp;", "");
                description = replace(description, "&rsquo;", "'");
                description = replace(description, "&lsquo;", "'");
                description = replace(description, "&ldquo;", "\"");
                description = replace(description, "&rdquo;", "\"");
                description = replace(description, "&ndash;", "-");

                description = replace(description, "&amp;", "&");
                description = replace(description, "&#039;", "'");
                description = replace(description, "Â", "");

            }
            //

            // End Parsing

            // display the page contents on the phone screen
            StringItem resultField = new StringItem(null, description,
                    Item.HYPERLINK);
            form.append(resultField);
String line=results.toString();
int position=line.indexOf(“”);
位置=行的索引(“>”,位置);
//
int position2=行indexOf(“,位置);
//
res=行子串(位置+1,位置2);
//
而(res.indexOf)