grabbing a line of text if you know the start and finish

N

neu

I have a text position and I would like to grab 100 characters before this
point and 100 charcters after this point.
Using indexOf(text) , how can I manipulate to see what 100 characters is
before the indexOf(text) result.?


JV
 
V

VisionSet

neu said:
I have a text position and I would like to grab 100 characters before this
point and 100 charcters after this point.
Using indexOf(text) , how can I manipulate to see what 100 characters is
before the indexOf(text) result.?

int idx = myString.indexOf(text);
myString.substring(Math.max(0,idx-100), idx);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,781
Messages
2,569,615
Members
45,294
Latest member
LandonPigo

Latest Threads

Top