• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

New Problem but solved by Manfred

 
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic