charat and multiple text

I have a long string of test that i want to receive vai a  method then search all the content and every thime I find something starting <BO I want to record it and return it via a method

Anyone know how to do this.  Note I need all characters after <BO until a space is entered in the test
enigma1234567890Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

 
VenabiliCommented:
Yes, use indexOf.

What problems do you have writing the method?
0
 
enigma1234567890Author Commented:
how do I know when I an at end of text
0
 
enigma1234567890Author Commented:
Sorry how do I know when at end of text and how do I get multiple text analysed.  I dont want to stop when i hit the first item
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
indigo23Commented:
try to use substring,

resultstring = longText.substring(longText.indexOf("
0
 
enigma1234567890Author Commented:
how do you edit the abolve code to tale all occurances of <BO
0
 
VenabiliCommented:
You use a cycle.

and you know that you are at the end of the text, when indexOf returns -1. Something like

int in = longText.indexOf("<BO");
while (in>0){
String startingWithBO = longText.substring(in); //do whatever you want with this one
//you might want to stop this to a > or a space - use a second parameter
longText = longText.substring(in+3);
in = longText.indexOf("<BO");
}

indigo23,

Using indexOf withput checking tends to throw exceptions :)
0

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
 
enigma1234567890Author Commented:
why do you use int in = longtxt.indexof


0
 
VenabiliCommented:
To find out where the next <BO starts
0
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.