wood burning stoves 2.0*
The moose likes Java in General and the fly likes New Problem but solved by Manfred Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "New Problem but solved by Manfred" Watch "New Problem but solved by Manfred" New topic
Author

New Problem but solved by Manfred

vivek sivakumar
Ranch Hand

Joined: Aug 09, 2001
Posts: 187
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 ]

SCJP, SCWD <br />A farmer learns more from a bad harvest than a good one.
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
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

Joined: Aug 09, 2001
Posts: 187
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: New Problem but solved by Manfred
 
Similar Threads
help with this , urgent
Well is it tough
Urgent help !!!!!!
getAttribute in a jsp
Same old pproblem.. a bit urgent