Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

New Problem but solved by Manfred

 
vivek sivakumar
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public static String getToken(String sContent,
String sToken,
String sTokenEnd) throws Exception
{
if (sContent != null && sContent.indexOf(sToken) >= 0)
{
sContent = sContent.substring(sContent.indexOf(sToken) + sToken.length());
return sContent.substring(0, sContent.indexOf(sTokenEnd));
}
return null;
}
note that number of <docid>....</docid> may vary
if the method is called like this getToken("abc<docid>58585</docid>jkdfklgjrit<docid>4535345</docid>tuturtut<docid>45355</docid>" , <docid>,</docid> then this function returns only one value of occurence of <docid>...</docid> , how can i make this function to return to return a String array containing all values found between <docid> .....</docid>
[ April 30, 2002: Message edited by: vivek sivakumar ]
[ April 30, 2002: Message edited by: vivek sivakumar ]
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vivek,
The result I gave you a while ago will work however you want it to ... as nike says: "JUST DO IT!"
In case you need a push the code below shows you how to convert the code I gave you into any one of three return types.

Regards,
Manfred.
 
vivek sivakumar
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
manfred tell me really r u some kind of supercomputer or what ???Thanks lot buddy , i have one more question to clear from you. hope u dont mind , its regarding io
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic