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

From: VisionSet (spam_at_ntlworld.com)
Date: 11/15/03


Date: Sat, 15 Nov 2003 16:33:02 -0000


"neu" <info@nospam.com> wrote in message
news:bp5i8t$7t4$1@sparta.btinternet.com...
> 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);

-- 
Mike W


Relevant Pages