Java: String.substring() with long type parameters

I have a large string (an RSS Article to be more precise) and I want to get the word in a specific startIndex and endIndex. String provides the substring method, but only using ints as its parameters. My start and end indexes are of type long.

What is the best way to get the word from a String using start and end indexes of type long?

My first solution was to start trimming the String and get it down so I can use ints. Didn't like where it was going. Then I looked at Apache Commons Lang but didn't find anything. Any good solutions?

Thank you.


Update:

Just to provide a little more information.

I am using a tool called General Architecture for Text Engineering (GATE) which scans a String and returns a list of Annotations. An annotation holds a type of a word (Person, Location, etc) and the start and end indexes of that word .

For the RSS, I use ROME, which reads an RSS feed and contains the body of the article in a String.

5
задан pek 23 September 2010 в 11:40
поделиться