Ito Kazumitsu wrote:
matchedText.substring(start[sub],end[sub]));
+       if (start[sub] >= 0 && end[sub] <= matchedText.length())
+           return (matchedText.substring(start[sub],end[sub]));
+       else {
+           StringBuffer sb = new StringBuffer();
+           for (int i = start[0] + start[sub]; i < start[0] + end[sub]; i++)
+               sb.append(matchedCharIndexed.charAt(i));
+           return sb.toString();
+       }

Use StringBuilder instead of StringBuffer.

David Daney.


Reply via email to