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
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

Yes, use indexOf.

What problems do you have writing the method?
enigma1234567890Author Commented:
how do I know when I an at end of text
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
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

try to use substring,

resultstring = longText.substring(longText.indexOf("
enigma1234567890Author Commented:
how do you edit the abolve code to tale all occurances of <BO
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");


Using indexOf withput checking tends to throw exceptions :)

Experts Exchange Solution brought to you by

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

To find out where the next <BO starts
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.