hi i am a begginer in java and i neeed help in completing this program...
sushant5252
0
Newbie Poster
Recommended Answers
Jump to PostTry to read line by line. Use the methods hasNextLine and readLine. Then save that line into a String.
Once you have the String, use the method indexOf(String) and find where the "<text>" and "</text>" are found. Then use the substring method.
All the above methods can be found at …
Jump to PostsubString(0+6, 10)
or
subString(0+"<text>".length(), 10)
Jump to PostOf course, you don't know where the tag starts or how long the text is, so
subString(s.indexOf("<text>")+"<text>".length(), s.indexOf("</text">));
would be closer to it. If that's difficult to read, take it apart piece by piece:
"<text>" is a string, so it has the String methods, so "<text>".length() …
All 9 Replies
yasuodancez
-3
Newbie Poster
sushant5252
0
Newbie Poster
javaAddict
900
Nearly a Senior Poster
Team Colleague
Featured Poster
NormR1
563
Posting Sage
Team Colleague
jon.kiparsky
326
Posting Virtuoso
javaAddict
900
Nearly a Senior Poster
Team Colleague
Featured Poster
jon.kiparsky
326
Posting Virtuoso
sushant5252
0
Newbie Poster
jon.kiparsky
326
Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.