Can anybody Send me Small java program for String manipulation

Hi experts

      iam new to java...
      and iam supposed to write a java program with manipulates the   string(http reponse text)  which contains many objectID's

  My method must return each objectid once when i call in the loop

  the response text looks like the following and i must return one objid value when i call once  ,plz note that the following text is stored in string
xxx xxx xxxxxxxxx xxx xxx xxx xxx
xxx  xxxx   xxx xxx  xxx xx xx  xx  xxx xxx xxx xxx xxx xx xxx
xx xxxx xxxx xxxx xxx xxxxx xxxx xxxx xxxx xxx xxx xxx xxx xxxx xx
xxx xxxx xxx x CrystalEnterprise_Hyperlink/ xxx xxx xxx xxx xxx xxx xxxxx xxx xxx xxx xxx xxx xxx xxx xx xxx xx xx
CrystalEnterprise_Hyperlink/ xxx xxx xxxx xxx
xxxx xxx xxxx xxx xxx

there are many "object ids" in the response text and the "pattern" will be the same for all the objects ids..

thanks in advance

Who is Participating?
i've made a method for u. try the following ,

//define these globally in ur class.

  Vector requiredStringsArray = new Vector();
  int firstIndexOfColon = -1;
  int lastIndexOfColon = -1;

// add followin method
  void getStr(String str)
      firstIndexOfColon = str.indexOf("objId=");
      if(firstIndexOfColon > -1)
        for(int i = firstIndexOfColon + 1; i < str.length(); i++)
          if((str.charAt(i) == ' ')) // blank space found
            lastIndexOfColon = i;
        requiredStringsArray.addElement(str.substring(firstIndexOfColon, lastIndexOfColon + 1));
        String s = str.substring((lastIndexOfColon + 1), str.length());

// now call that method passing your string
String yourString = "CrystalEnterprise_Hyperlink/ xxxx xxx x CrystalEnterprise_Hyperlink/ ";

    getStr(yourString );

//-- display extracted stings
    for(int i = 0; i < requiredStringsArray.size(); i++)
navarathna, you're obviously new to this site too. The idea of it is not to provide questioners with a custom code/ homework writing service, but rather to help them with code they've already produced.

You need to read the response into a buffer and then search it
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.