Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8570133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:29:26+00:00 2026-06-11T18:29:26+00:00

I’m a noob to android development and i am trying to remove a string

  • 0

I’m a noob to android development and i am trying to remove a string of dynamic characters from a string. My string:

"Beginning of String....<img src="http://webaddress.com" height="1" width="1"/>"

I want to remove the “&lt”, “&gt”, and everything between them. All i want is “Beginning of String…” So far i have tried this with no success.

description = description.replaceFirst("(?s)(&lt)(.*?)(&gt)","$1$3");

Also i tried this on a similar similar string and it worked fine, so i don’t understand what i am doing wrong.

description = description.replaceFirst("(?s)(<sub>)(.*?)(</sub>)","$1$3");

My class

public class RssReader {

private final static String BOLD_OPEN = "<B>";
private final static String BOLD_CLOSE = "</B>";
private final static String BREAK = "<BR>";
private final static String ITALIC_OPEN = "<I>";
private final static String ITALIC_CLOSE = "</I>";
private final static String SMALL_OPEN = "<SMALL>";
private final static String SMALL_CLOSE = "</SMALL>";


public static List<JSONObject> getLatestRssFeed(){
    String feed = "http://feeds.feedburner.com/MetalMarketCommentary";
    //http://globoesporte.globo.com/dynamo/futebol/times/vasco/rss2.xml
    //http://feeds.feedburner.com/GoldMoneyGoldResearch +
    //http://feeds.feedburner.com/GoldsilvercomNews +
    //http://feed43.com/7466558277232702.xml
    //http://feeds.feedburner.com/SilverGoldDaily
    //http://feeds.feedburner.com/MetalMarketCommentary
    //http://link.brightcove.com/services/player/bcpid1683318714001?bckey=AQ~~,AAAAC59qSJk~,vyxcsD3OtBPHZ2UIrFX2-wdCLTYNyMNn&bclid=1644543007001&bctid=1854182861001

    RSSHandler rh = new RSSHandler();
    List<Article> articles =  rh.getLatestArticles(feed);
    Log.e("RSS ERROR", "Number of articles " + articles.size());
    return fillData(articles);
}



private static List<JSONObject> fillData(List<Article> articles) {

    List<JSONObject> items = new ArrayList<JSONObject>();
    for (Article article : articles) {
        JSONObject current = new JSONObject();
        try {
            buildJsonObject(article, current);
        } catch (JSONException e) {
            Log.e("RSS ERROR", "Error creating JSON Object from RSS feed");
        }
        items.add(current);
    }

    return items;
}



private static void buildJsonObject(Article article, JSONObject current) throws JSONException {
    String title = article.getTitle();
    String description = article.getDescription();
    description = description.replaceFirst("(?s)(<sub>)(.*?)(</sub>)","$1$3");
    int start = description.indexOf(".&");
    description= description.substring(0, start);
    String date = article.getPubDate();
    String imgLink = article.getImgLink();

    StringBuffer sb = new StringBuffer();
    sb.append(BOLD_OPEN).append(title).append(BOLD_CLOSE);
    sb.append(BREAK);
    sb.append(description);
    sb.append(BREAK);
    sb.append(SMALL_OPEN).append(ITALIC_OPEN).append(date).append(ITALIC_CLOSE).append(SMALL_CLOSE);

    current.put("text", Html.fromHtml(sb.toString()));
    current.put("imageLink", imgLink);
}
}

XML I am parsing

<item>
           <title>Gold Market Recap Report</title>
           <link>http://feedproxy.google.com/~r/MetalMarketCommentary/~3/jGYtkXdSKWs/mid-session-gold_703.html</link>
           <description>&lt;img src="http://www.cmegroup.com/images/1x1trans.gif?destination=http://www.cmegroup.com/education/market-commentary/metals/2012/09/mid-session-gold_703.html" alt=""/&gt;For the week December gold forged a trading range of roughly $37 an ounce. With gold prices attimes seemingly on the rocks and poised for a downside washout it was a change of pace to see afresh upside breakout in the Friday morning trade....&lt;img src="http://feeds.feedburner.com/~r/MetalMarketCommentary/~4/jGYtkXdSKWs" height="1" width="1"/&gt;</description>
           <pubDate>Fri, 21 Sep 2012 19:50:37 GMT</pubDate>
           <guid isPermaLink="false">http://www.cmegroup.com/education/market-commentary/metals/2012/09/mid-session-gold_703.html?source=rss</guid>
           <dc:date>2012-09-21T19:50:37Z</dc:date>
           <feedburner:origLink>http://www.cmegroup.com/education/market-commentary/metals/2012/09/mid-session-gold_703.html?source=rss</feedburner:origLink>
      </item>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:29:27+00:00Added an answer on June 11, 2026 at 6:29 pm
        String string = "Beginning of String....&lt;img src=\"http://webaddress.com\" height=\"1\" width=\"1\"/&gt;"; //Escape whatever has to be escaped
        System.out.println(string);
        int start = string.indexOf("&");
        int end = string.lastIndexOf("&");
        String temp = string.substring(start, (end+3));
        string = string.replace(temp, "");
        System.out.println(string);
    

    This will remove anything between &lt and &gt, including them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.